Answers.Body: <p>Have been able to get over the session key error by installing a fresh install of WP and CiviCRM, then restoring Wordpress and CiviCRM DBs, repointing wp_config.php and CiviCRM.settings.php. Also had to rename my table prefixes in wp_config.php to match my restored tables. The caches get created once you start up CiviCRM and do things. Testing so far all functionality is working again. Hopefully this may help someone should you come across this issue which is pretty horrible.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-08T07:11:21.557Z
Answers.LastActivityDate: 2020-09-08T07:11:21.557Z
Answers.UserDisplayName: Garry Hyman
Body: <p>Help needed. The error below is received when I click on the submit button for a petition (survey). This function has been working fine for several months. There are no customisations in place in this area.
  Wordpress was updated to 5.5.1. - The error only occurred since this last upgrade occurred.
  CiviCRM 5.27.1
  PHP 7.3.17</p>
  <pre><code>(
      [message] =&gt; We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.&lt;br /&gt;&lt;br /&gt;Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.&lt;br /&gt;&lt;br /&gt;Error type: Could not find a valid session key.
      [code] =&gt; 
  )
  
  
  Sep 04 14:04:55  [debug] $backTrace = #0 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(354): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(817): CRM_Core_Error::fatal(&quot;We can't load the requested web page. This page requires cookies to be enable...&quot;)
  #2 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(812): CRM_Core_Controller-&gt;invalidKeyCommon()
  #3 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(296): CRM_Core_Controller-&gt;invalidKey()
  #4 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(190): CRM_Core_Controller-&gt;key(&quot;CRM_Campaign_Form_Petition_Signature&quot;, TRUE, FALSE)
  #5 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller/Simple.php(50): CRM_Core_Controller-&gt;__construct(&quot;Sign Petition&quot;, TRUE, NULL, &quot;CRM_Campaign_Form_Petition_Signature&quot;, TRUE, FALSE)
  #6 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(62): CRM_Core_Controller_Simple-&gt;__construct(&quot;CRM_Campaign_Form_Petition_Signature&quot;, &quot;Sign Petition&quot;, NULL, FALSE, FALSE, FALSE, FALSE)
  #7 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(285): CRM_Utils_Wrapper-&gt;run(&quot;CRM_Campaign_Form_Petition_Signature&quot;, &quot;Sign Petition&quot;, (Array:0))
  #8 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:14))
  #9 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #10 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm.php(1537): CRM_Core_Invoke::invoke((Array:3))
  #11 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/includes/civicrm.basepage.php(352): CiviCRM_For_WordPress-&gt;invoke()
  #12 /home/cremorne/www/www/devwp2/wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress_Basepage-&gt;basepage_handler(Object(WP))
  #13 /home/cremorne/www/www/devwp2/wp-includes/class-wp-hook.php(311): WP_Hook-&gt;apply_filters(NULL, (Array:1))
  #14 /home/cremorne/www/www/devwp2/wp-includes/plugin.php(544): WP_Hook-&gt;do_action((Array:1))
  #15 /home/cremorne/www/www/devwp2/wp-includes/class-wp.php(758): do_action_ref_array(&quot;wp&quot;, (Array:1))
  #16 /home/cremorne/www/www/devwp2/wp-includes/functions.php(1285): WP-&gt;main(&quot;&quot;)
  #17 /home/cremorne/www/www/devwp2/wp-blog-header.php(16): wp()
  #18 /home/cremorne/www/www/devwp2/index.php(17): require(&quot;/home/cremorne/www/www/devwp2/wp-blog-header.php&quot;)
  #19 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-04T05:23:40.220Z
Comments.Text: Have cleared cache, reviewed base URL paths and all OK. There have been no changes except for Wordpress being upgraded to 5.5.1 from 5.5.
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-04T17:26:41.787Z
Comments.Text: Is there a reason not to upgrade to the latest CiviCRM? FWIW, I just successfully submitted a petition in WordPress 5.5.1 & CiviCRM 5.29.0
Comments.UserDisplayName: Christian Wach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-06T01:32:26.520Z
Comments.Text: Thanks for your reply Christian.The usual responses for NOT upgrading apply: we just got to 5.27.1 in the last few weeks. Have a critical time period now so don't want to upset the applecart by upgrading right now. Having said that I have tried
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-06T01:40:25.473Z
Comments.Text: Time is always precious and short. Having said that I have tried upgrading a test environment 5.27.1 to 5.29 and the upgrade screen is presented to me but when I click the upgrade button it thinks for a moment and then just takes me to the homepage. The [civicrm.files] variable is correct and aligns so I am puzzled. Have tried adding a Global Paths for URL to civicrm.settings and no luck. Any thoughts here? I am sure it has something to do with the [civicrm.files] variable. We installed prior to version 4.7 so the calculation around this seem to be causing this issue.
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-06T01:40:33.603Z
Comments.Text: Have migrated files as per upgrade instructions too. This is so frustrating sometimes!
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-07T09:01:52.490Z
Comments.Text: What's the code for your paths in civicrm.settings.php (anonymised, of course!)
Comments.UserDisplayName: Christian Wach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-08T01:38:25.880Z
Comments.Text: /*global $civicrm_paths;
  $civicrm_paths['civicrm.files']['path'] = '/mywebsitedirectories/wp-content/uploads/civicrm/';
  $civicrm_paths['civicrm.files']['url'] = 'https://mywebsite.com/wp-content/uploads/civicrm/';*/
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-09T09:23:26.283Z
Comments.Text: Seems you're sorted - good news
Comments.UserDisplayName: Christian Wach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-11T03:55:52.923Z
Comments.Text: Christian it has happened again. I cannot work out if it possibly corruption somewhere or a bug in CiviCRM/Wordpress. I installed from scratch Wordpress 5.5.1 pointed WP to the wordpress DB (copy of Prod) and installed Civi 5.27.0 and then pointed to the Civi database (copy from Prod) in a development environment. It all seemed fine the day I did it with donations, Petitions and other functions working.
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-11T03:56:00.560Z
Comments.Text: 2 days later I thought I would check something to discover the error related to session key is back again. An example is when entering Petition (survey) data and then clicking submit it errors with the session key error. If anyone has some ideas I would be grateful as this is causing us much pain. Interestingly, in Production, the search box no longer works and when the Find Contacts page is used it runs and displays the Advanced Search page. Yep you read right!
Comments.UserDisplayName: Garry Hyman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-11T11:51:55.447Z
Comments.Text: Are you modifying your `DEFINER` and `TRIGGER` statements in the CiviCRM SQL data for your dev environment?
Comments.UserDisplayName: Christian Wach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-12T12:08:49.450Z
Comments.Text: No I am not, should I be? And if so to what?
Comments.UserDisplayName: Garry Hyman
Tags: <wordpress><petition>
Title: Could not find a valid session key when submitting Petition
ThreadText: # Could not find a valid session key when submitting Petition
  
  (Asked by: username_0 on 2020-09-04)
  
  Help needed. The error below is received when I click on the submit button for a petition (survey). This function has been working fine for several months. There are no customisations in place in this area.
  Wordpress was updated to 5.5.1. - The error only occurred since this last upgrade occurred.
  CiviCRM 5.27.1
  PHP 7.3.17
  
  ```
  (
      [message] => We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.<br /><br />Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.<br /><br />Error type: Could not find a valid session key.
      [code] => 
  )
  
  Sep 04 14:04:55  [debug] $backTrace = #0 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(354): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(817): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
  #2 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(812): CRM_Core_Controller->invalidKeyCommon()
  #3 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(296): CRM_Core_Controller->invalidKey()
  #4 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(190): CRM_Core_Controller->key("CRM_Campaign_Form_Petition_Signature", TRUE, FALSE)
  #5 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller/Simple.php(50): CRM_Core_Controller->__construct("Sign Petition", TRUE, NULL, "CRM_Campaign_Form_Petition_Signature", TRUE, FALSE)
  #6 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(62): CRM_Core_Controller_Simple->__construct("CRM_Campaign_Form_Petition_Signature", "Sign Petition", NULL, FALSE, FALSE, FALSE, FALSE)
  #7 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(285): CRM_Utils_Wrapper->run("CRM_Campaign_Form_Petition_Signature", "Sign Petition", (Array:0))
  #8 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:14))
  #9 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
  #10 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/civicrm.php(1537): CRM_Core_Invoke::invoke((Array:3))
  #11 /home/cremorne/www/www/devwp2/wp-content/plugins/civicrm/includes/civicrm.basepage.php(352): CiviCRM_For_WordPress->invoke()
  #12 /home/cremorne/www/www/devwp2/wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
  #13 /home/cremorne/www/www/devwp2/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, (Array:1))
  #14 /home/cremorne/www/www/devwp2/wp-includes/plugin.php(544): WP_Hook->do_action((Array:1))
  #15 /home/cremorne/www/www/devwp2/wp-includes/class-wp.php(758): do_action_ref_array("wp", (Array:1))
  #16 /home/cremorne/www/www/devwp2/wp-includes/functions.php(1285): WP->main("")
  #17 /home/cremorne/www/www/devwp2/wp-blog-header.php(16): wp()
  #18 /home/cremorne/www/www/devwp2/index.php(17): require("/home/cremorne/www/www/devwp2/wp-blog-header.php")
  #19 {main}
  
  ```
  
  **Tags:** wordpress, petition
  
  > **Comments:**
  > **username_0**: Have cleared cache, reviewed base URL paths and all OK. There have been no changes except for Wordpress being upgraded to 5.5.1 from 5.5.  
  > **username_1**: Is there a reason not to upgrade to the latest CiviCRM? FWIW, I just successfully submitted a petition in WordPress 5.5.1 & CiviCRM 5.29.0  
  > **username_0**: Thanks for your reply username_1.The usual responses for NOT upgrading apply: we just got to 5.27.1 in the last few weeks. Have a critical time period now so don't want to upset the applecart by upgrading right now. Having said that I have tried  
  > **username_0**: Time is always precious and short. Having said that I have tried upgrading a test environment 5.27.1 to 5.29 and the upgrade screen is presented to me but when I click the upgrade button it thinks for a moment and then just takes me to the homepage. The [civicrm.files] variable is correct and aligns so I am puzzled. Have tried adding a Global Paths for URL to civicrm.settings and no luck. Any thoughts here? I am sure it has something to do with the [civicrm.files] variable. We installed prior to version 4.7 so the calculation around this seem to be causing this issue.  
  > **username_0**: Have migrated files as per upgrade instructions too. This is so frustrating sometimes!  
  > **username_1**: What's the code for your paths in civicrm.settings.php (anonymised, of course!)  
  > **username_0**: /*global $civicrm_paths; $civicrm_paths['civicrm.files']['path'] = '/mywebsitedirectories/wp-content/uploads/civicrm/'; $civicrm_paths['civicrm.files']['url'] = 'https://mywebsite.com/wp-content/uploads/civicrm/';*/  
  > **username_1**: Seems you're sorted - good news  
  > **username_0**: username_1 it has happened again. I cannot work out if it possibly corruption somewhere or a bug in CiviCRM/Wordpress. I installed from scratch Wordpress 5.5.1 pointed WP to the wordpress DB (copy of Prod) and installed Civi 5.27.0 and then pointed to the Civi database (copy from Prod) in a development environment. It all seemed fine the day I did it with donations, Petitions and other functions working.  
  > **username_0**: 2 days later I thought I would check something to discover the error related to session key is back again. An example is when entering Petition (survey) data and then clicking submit it errors with the session key error. If anyone has some ideas I would be grateful as this is causing us much pain. Interestingly, in Production, the search box no longer works and when the Find Contacts page is used it runs and displays the Advanced Search page. Yep you read right!  
  > **username_1**: Are you modifying your `DEFINER` and `TRIGGER` statements in the CiviCRM SQL data for your dev environment?  
  > **username_0**: No I am not, should I be? And if so to what?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-09-08. Score: 0
  
  Have been able to get over the session key error by installing a fresh install of WP and CiviCRM, then restoring Wordpress and CiviCRM DBs, repointing wp\_config.php and CiviCRM.settings.php. Also had to rename my table prefixes in wp\_config.php to match my restored tables. The caches get created once you start up CiviCRM and do things. Testing so far all functionality is working again. Hopefully this may help someone should you come across this issue which is pretty horrible.
  
  
  ---
  
  