0

On version 5.6.0, using api v3. Not sure if something recently changed in our environment, but as of a couple of days ago, running the contact create api (via rest or the explorer) causes a "DB Error: no database selected" error when using the "dupe_check" parameter.

For example, if I run this call, the contact is created and api returns successfully:

https://domain.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=create&api_key=userkey&key=sitekey&json={"contact_type":"Individual","first_name":"pol","last_name":"vor","email":"povor@gmail.com"}

But if I run this call, which just has "dupe_check:1" added to it, it fails:

https://domain.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=create&api_key=userkey&key=sitekey&json={"contact_type":"Individual","first_name":"pol","last_name":"vor","email":"povor@gmail.com","dupe_check":1}

The error details are as follows (from the API Explorer, but it's the same running from a script):

    {
    "code": -14,
    "error_message": "DB Error: no database selected",
    "mode": 16,
    "debug_info": "DROP TEMPORARY TABLE IF EXISTS dedupe [nativecode=2006 ** MySQL server has gone away]",
    "type": "DB_Error",
    "user_info": "DROP TEMPORARY TABLE IF EXISTS dedupe [nativecode=2006 ** MySQL server has gone away]",
    "to_string": "[db_error: message=\"DB Error: no database selected\" code=-14 mode=callback callback=CRM_Utils_REST::fatal prefix=\"\" info=\"DROP TEMPORARY TABLE IF EXISTS dedupe [nativecode=2006 ** MySQL server has gone away]\"]",
    "is_error": 1
}

Any ideas on what may be causing this? I have a workaround in production for now, but this is a really useful feature to have in the API.

1

Try upgrading to 5.13.2 since there is lots of change in dedupe rule code since 5.6.

Cheers

Pradeep

  • Hate to ask, but any options outside of upgrading? Upgrading is going to take a while in our situation. It's just odd that it just started happening. – Paul B May 9 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.