Closed laryn closed 5 years ago
It looks like this will need some work to function alongside Webform-CiviCRM:
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.
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.
Error type: Could not find a valid session key.
It actually does create both the CiviCRM contact and the Backdrop user before it crashes with the screen above.
Is it possible this is somehow related to https://github.com/backdrop-contrib/webform_registration/issues/2 ? (The custom URL workaround in that issue doesn't fix this issue, unfortunately)
More from the CiviCRM backtrace error logs:
[info] $backTrace = /path-to-site/modules/civicrm/CRM/Core/Error.php(381): CRM_Core_Error::backtrace("backTrace", TRUE)
/path-to-site/modules/civicrm/CRM/Core/Controller.php(833): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
/path-to-site/modules/civicrm/CRM/Core/Controller.php(828): CRM_Core_Controller->invalidKeyCommon()
/path-to-site/modules/civicrm/CRM/Core/Controller.php(312): CRM_Core_Controller->invalidKey()
/path-to-site/modules/civicrm/CRM/Core/Controller.php(204): CRM_Core_Controller->key("CRM_Profile_Form_Dynamic", TRUE, FALSE)
/path-to-site/modules/civicrm/CRM/Core/Controller/Simple.php(66): CRM_Core_Controller->__construct("Dynamic Form Creator", TRUE, 2, "CRM_Profile_Form_Dynamic", TRUE, FALSE)
/path-to-site/modules/civicrm/CRM/Core/BAO/UFGroup.php(834): CRM_Core_Controller_Simple->__construct("CRM_Profile_Form_Dynamic", "Dynamic Form Creator", 2)
/path-to-site/modules/civicrm/backdrop/civicrm_user.inc(75): CRM_Core_BAO_UFGroup::getEditHTML(211, "", 2, TRUE, FALSE, NULL, FALSE, "Individual")
/path-to-site/core/includes/module.inc(955): civicrm_user_insert(Object(User))
I'm not yet sure what the CRM_Core_Controller->invalidKey()
portion refers to.
@herbdool Do you have any ideas on this one? Or even a direction I can start looking? I tried adding $session = CRM_Core_Session::singleton();
before creating the user (to ensure there was a session) but it didn't seem to do anything helpful.
Without looking at the code it seems like the form key isn't getting passed on? When I get a chance I'll try to take a look.
@herbdool Does CiviCRM need/expect a key from a CiviCRM form somehow, or is there a key on a webform that needs to be passed somehow?
From what I can tell CiviCRM forms need keys to keep secure. Take a look at CRM_Core_Controller->key and maybe put in some debugging to see if it can find a key.
@herbdool Thanks. I've looked in here a bit... but this is not using a CiviCRM form, is it? It's a Webform (using Webform-CiviCRM admittedly) and submitting a Backdrop user via a Backdrop function. Everything that is supposed to happen in CiviCRM is happening already behind the scenes somehow – a CiviCRM contact is created, a Backdrop user is created, and they are linked together already when I view the CiviCRM contact (after I load CiviCRM and find the contact following the fatal crash).
Is there a way I can tell CiviCRM I'm not using a CiviCRM form so it doesn't expect a CiviCRM key? I see a "ignoreKey" parameter in the construct function in the Controller class but don't see how I can change that from the code in this module.
@herbdool I was trying to do a quick port of user_import
and after some initial success I ran into this same exact issue. I put some debugging in CRM_Core_Controller
and there is no key (when I debug $this
most of the values are NULL). Is this a CiviCRM problem or something about the way I'm porting these modules, do you think?
Interesting. I think I've used user_import on a Drupal/CiviCRM site and don't recall this issue. Might be worth retesting on a clean install. So the issue is at the point when a Civi contact is created along with the user import?
@herbdool The error seems to happen after the user is created/imported/saved. In both cases, the new user is created, there is a new contact in CiviCRM, and they are linked together with a UF Match as expected. Then the error above shuts everything down. I'm a bit baffled. I created an issue in the port-in-progress for user_import
(linked above) which works at a most basic level (haven't tested more deeply yet) on a site with no CiviCRM and errors as above if CiviCRM is installed.
Adding one more confirmation that this is a more widespread issue than the two modules in question here: I decided to short circuit this for now to import a list of users to a live site that is running CiviCRM, and use Feeds to get the list in place. I tested with a CSV that had info for one user account in it, and the import errored out with the same error message, and (you guessed it) the user had already been created and linked in CiviCRM.
As this is a CiviCRM issue, not an issue with this module, I'm not going to let it hold up making an initial release.
Untested: make sure that a CiviCRM email field (via Webform-CiviCRM) can be used as the account email.