Failed change email log entry even though email is updated with success

When a successful PATCH is run to /api/v2/users in order to update a user’s email address, there is a Failed Change Email error in the logs followed milliseconds later by a successful API Operation entry.

The user record looks as expected; the updates are applied, so I’m having trouble understanding what might be causing the error in the logs.

Has anyone seen anything similar?


Update:

This is one of the two results of a successful call. The email updates as noted between the ‘email’ and ‘newEmail’. Additionally, this occurs for every request and this occurs for every user.

"type": "fce", "description": "The operation cannot be completed. Please try again.", "client_name": "N/A", "user_agent": "unknown", "details": { "body": { "tenant": "dev", "email": "chris.p.dunbar@gmail.com", "newEmail": "chris.pdunbar@gmail.com", "verify": false, "email_verified": false } }, "user_name": "chris.p.dunbar@gmail.com", "strategy": "auth0", "strategy_type": "database",

@chris.p.dunbar can you provide the following for me to investigate:

  • Does this happen for every PATCH request, or only intermittently?
  • Does it happen for every user, or only a single user?
  • Can you provide the log content - feel free to remove/modify any sensitive or personally identifiable tenant/user information.

There’s one situation that might trigger the behavior you described, more specifically, if you have a custom database for which you provided a change_email script, but on the provided script your logic fails to signal that the email change occurred with success then you may be changing the user email with success but the failure log is still created because the script did not indicate success.

At this point the change_email script is not configurable through the Dashboard so you may have done it through the Management API. You can use the connection related endpoints to check if you have this script and in addition fix its logic if this proves to be the source of problem.

The script in question is similar to the change password script in terms of how the script should call the callback function to signal success, more specifically it will need to do the following:

// after having updated the user email with success call the callback function
// with a boolean true as second parameter to signal that the email was changed with success
callback(null, true);

If you are using a custom database connection and your script does not meet the above requirement then please update it through the Management API.

This is exactly the scenario. Glad you were able to clue into it. Thanks!