0

I've spent a ton of volunteer hours getting CiviCRM 5.37.2 set up for this new non-profit on a WordPress site. Got Sparkpost hooked up to CiviMail. Tested the Unsubscribe/Opt-Out link in the footer of an email and it fails with 'Could not find a valid session key'. All the other links in the email Header/Footer work. The same version of Civi works fine under DreamHost, but not Cloudways. Cloudways support spent a lot of time with me, checked the PHP and Apache logs, but couldn't see any error. They had me add a line to my PHP settings to save the session path, but the problem persists. I really hope y'all can point me in the right direction! Here are some screen shots:

Test email:Test Email https://votersfirstwi.org/civicrm/mailing/optout/?reset=1&jid=18&qid=19&h=1c6ac906312244a3

Opt-Out Screen: Opt-Out screen https://votersfirstwi.org/civicrm/mailing/optout/

Error Message: Error Message

The Civi Log says this:

$Fatal Error Details = array:3 [
  "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" => null
  "exception" => CRM_Core_Exception {#6809
    -errorData: array:1 [
      "error_code" => 0
    ]
    #cause: null
    -_trace: null
    #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: 0
    #file: "/home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php"
    #line: 829
    trace: {
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:829 {
        ›   $msg = ts("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 />' . ts('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 />' . ts('Error type: Could not find a valid session key.');
        ›   throw new CRM_Core_Exception($msg);
        › }
      }
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:824 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:308 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:190 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller/Simple.php:49 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php:62 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:286 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm.php:1172 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php:354 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/class-wp-hook.php:292 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/class-wp-hook.php:316 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/plugin.php:551 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/class-wp.php:763 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/functions.php:1291 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-blog-header.php:16 { …}
      /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/index.php:17 { …}
    }
  }
]


Aug 13 10:49:09  [debug] $backTrace = #0 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(433): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
#2 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/civicrm.php(1172): CRM_Core_Invoke::invoke((Array:3))
#3 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php(354): CiviCRM_For_WordPress->invoke()
#4 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/class-wp-hook.php(292): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#5 /home/xxxxxxx.cloudwaysapps.com/xxxxxxx/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters("", (Array:1))
#6 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/plugin.php(551): WP_Hook->do_action((Array:1))
#7 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/class-wp.php(763): do_action_ref_array("wp", (Array:1))
#8 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-includes/functions.php(1291): WP->main("")
#9 /home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-blog-header.php(16): wp()
#10 /home/xxxxxx.cloudwaysapps.com/xxxxxxx/public_html/index.php(17): require("/home/xxxxxx.cloudwaysapps.com/xxxxxx/public_html/wp-blog-header.php")
#11 {main}

I found two seemly relevant threads here in StackExchange:

Could not find a valid session key when submitting opt out and unsubscribe forms

"Could not find a valid session key." Unable to save any admin forms

Please help...thanks!!!

UPDATE: CiviCRM is causing WordPress Site Health Critical Errors (they go away when CiviCRM is deactivated). What the heck is going on here? enter image description here

8
  • may not be relevant, and it is possible it is in the above, but what version of php are you using?
    – petednz - fuzion
    Commented Aug 13, 2021 at 20:26
  • Pertinent question...7.3...thanks for looking...and I've cleared my cache lots of times...
    – jimcrist
    Commented Aug 14, 2021 at 3:28
  • Ugh...I upgraded to 7.4 PHP, but the error persists. Is this a bug in CiviCRM? I'm on WordPress 5.7.2.
    – jimcrist
    Commented Aug 14, 2021 at 14:32
  • I updated my question to include the URLs that occur during the opt-out attempt. Please help...
    – jimcrist
    Commented Aug 14, 2021 at 15:27
  • 1
    Good news sort of...I upgraded to Civi 5.40.1 and the session key error went away! So CiviMail is communicating with Sparkpost to send the email. I can click unsubscribe, the opt-out screen appears, I enter the email address, click opt-out and it fails to display the opt-out confirmation screen...ugh! The URL does not change, but it clears out the email address field. No confirmation!! The opt-out does process in the CiviCRM database, so that's good. How do I get the confirmation screen to display???
    – jimcrist
    Commented Aug 17, 2021 at 2:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.