CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Valid Key Error when creating a Drupal user with an existing email in CiviCRM
Pages: [1]

Author Topic: Valid Key Error when creating a Drupal user with an existing email in CiviCRM  (Read 1673 times)

mcarbone

  • Guest
Valid Key Error when creating a Drupal user with an existing email in CiviCRM
July 16, 2007, 03:09:46 pm
Oops, I posted this in the CiviContribute subforum by mistake.  Trying again:

I know there have been variations of this problem posted on this forum, and I've looked through them all.  I've started a new thread because this one is slightly different.  I can create a new user in Drupal with no problems, as long as the email isn't already in CiviCRM.  If a contact with the email already exists, I get this backtrace and error:

Code: [Select]
backTrace

/stuff/modules/civicrm/CRM/Core/Error.php, backtrace, 236
/stuff/modules/civicrm/CRM/Core/Controller.php, fatal, 178
/stuff/modules/civicrm/CRM/Core/Controller.php, key, 132
/stuff/modules/civicrm/CRM/Core/Controller/Simple.php, crm_core_controller, 60
/stuff/modules/civicrm/CRM/Core/BAO/UFGroup.php, crm_core_controller_simple, 467
/stuff/modules/civicrm/drupal/civicrm.module, getedithtml, 440
/stuff/modules/civicrm/drupal/civicrm.module, civicrm_register_data, 352
, civicrm_user,
/stuff/includes/module.inc, call_user_func_array, 386
/stuff/modules/user/user.module, module_invoke, 2437
/stuff/modules/user/user.module, _user_forms, 1182
, user_register,
/stuff/includes/form.inc, call_user_func_array, 218
, drupal_retrieve_form,
/stuff/includes/form.inc, call_user_func_array, 69
, drupal_get_form,
/stuff/includes/menu.inc, call_user_func_array, 418
/stuff/index.php, menu_execute_active_handler, 15

Sorry. A non-recoverable error has occurred.
Could not find valid Key

Return to CiviCRM menu.

Based on suggestions in other threads, I've:
1) disabled Drupal caching, and truncated cache and sessions
2) verified a user 0
3) verified base_url match

And I've tried truncating civicrm_uf_match and removing all duplicate rules as well.

I am using PHP 4.3.8, Drupal 5.1, and the latest stable release of CiviCRM 1.7 (9821).  Any debugging suggestions?

Thanks,
marco

mcarbone

  • Guest
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 17, 2007, 12:37:36 pm
Well, I narrowed the problem down to the form key and session key not matching.  But when I tried to inspect these variables to see where things are going awry, the error goes away.  Whether I inspect with print statements or watchdog queries, the error disappears.  So it's pretty difficult to figure out where things are going wrong when the very act of looking fixes the problem.  I guess this is somewhat analogous to the Uncertainty Principle.

In any case, leaving a watchdog statement in there "solves" the problem, but not in any way that makes me feel good.  Very strange.

mcarbone

  • Guest
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 23, 2007, 02:39:32 pm
Hmm, so what I wrote above didn't actually work, which actually makes me feel better because it seemed arbitrary.  I thought I had tested disabling Drupal cache, but in any case, at this point it seems clear to me that I am getting this problem because of the anonymous caching problem documented here:

http://wiki.civicrm.org/confluence/display/CRMDOC/Install+CiviCRM+1.7+for+Drupal#InstallCiviCRM1.7forDrupal-%26nbsp%3BDrupalPageCachingOptionalConfiguration

I slightly modified this solution, changing:

Code: [Select]
  if (substr($_GET['q'], 0, 7) == 'civicrm') {
to

Code: [Select]
  if (substr($_GET['q'], 0, 7) == 'civicrm' || substr($_GET['q'], 0, 4) == 'user') {
This disables Drupal caching on user pages as well, which don't need to be cached but involves civicrm functionality not caught by checking for 'civicrm'.  I hope this helps someone else out.

If someone knows more about this Drupal/CiviCRM caching conflict, can you point me to a relevant issue/thread/doc?  Is it being worked on for 1.8 or 2.0?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 23, 2007, 04:00:12 pm

This is not fixed in 1.8. Would be great for a patch to be submitted to fix this for 2.0 and Drupal 6 :). Would be cool if we can figure out how to get caching and quickform/sessions to play nicely together. I suspect the change might have to be on both the drupal and civicrm sides.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mcarbone

  • Guest
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 23, 2007, 06:19:16 pm
What is the issue on Drupal's end, do you think?  I'd be happy to start a conversation on it over in Drupal-land.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 23, 2007, 06:26:44 pm

I dont know enough about whats going wrong and why/how it affects things to say anything specific. My comment was based on this being an interaction between the drupal caching system and the CiviCRM form / session code. I also dont think its just restricted to the 'valid key' since we had issues with regrd to this before we introduced the 'key' token validation

As with such gnarly issues, someone would need to spend a fair amount of time setting the scenario and various test cases and expected outcomes.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

ehlondon

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
Re: Valid Key Error when creating a Drupal user with an existing email in CiviCR
July 25, 2007, 08:56:51 am
I was getting the same issue with search. I found a post that suggested I check the collation of my sessions table in drupal database. It should be utf8. Mine was latin_sweedish, and after I changed it(exported it, changed "latin_sweedish" to utf8 then dropped the one in the database and imported the modified export) to utf8, the search works fine. I haven't tested civicontribute, which had same problem earlier.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Valid Key Error when creating a Drupal user with an existing email in CiviCRM

This forum was archived on 2017-11-26.