drupal captcha recaptcha session id error

How to fix Drupal CAPTCHA ReCaptcha validation error: unknown CAPTCHA session ID

Submitted by gazza on Mon, 14/12/2020 - 08:32

Edit the recaptcha.module file inside the ReCaptcha module (usually in: modules/recaptcha) and change this code:

// As the validate callback does not depend on sid or solution, this // captcha type can be displayed on cached pages. $captcha['cacheable'] = TRUE;

To this code:

// As the validate callback does not depend on sid or solution, this // captcha type can be displayed on cached pages. //$captcha['cacheable'] = TRUE; $captcha['cacheable'] = FALSE; \Drupal::service('page_cache_kill_switch')->trigger();