Overview
This article will provide troubleshooting steps for the error user update failed: The user does not exist. during Account Linking using Actions, when there is a subsequent Action with a redirection.
Applies To
- Account linking
- Action
- Redirect with action
- Account linking with actions
Cause
This is a known limitation. If a redirect is performed in a subsequent action after the primary User has been changed, it appears an aspect of this ID update is lost, and it can lead to user mismatch errors like the one above.
Solution
A possible workaround is re-applying the primary user with the now updated event object’s copy of the user_ID, in the Action that has the redirection on the onContinuePostLogin code block:
exports.onContinuePostLogin = async (event, api) => {
api.authentication.setPrimaryUser(event.user.user_id);