Migration Auth0 rules to actions: event.user.identities are not updated in one action flow

Hi,

I started migration our Auth0 rules to actions and our first rule is called linkAccountsWithSameEmailAddress for linking db user with social user with the same email. But I noticed strange behavior:

If I link users to one in linkAccountsWithSameEmailAddress action, in the action running right after this action (same flow), event.user.identities are still without linking (like original before execution of linkAccountsWithSameEmailAddress action).

Why is this happening?

To get up to date event.user.identities (with both providers), I started to get user data by Auth0 management:

const response = await management.users.get({id: event.user.user_id});

but it is another request, so I thought if it’s possible somehow replace it.

Thank you for help.

Hi @ondrej1,

Are your account linking actions performing any redirects? Actions that perform an Execution that yields back (such as a redirect) may result in subsequent actions being scheduled on a separate instance with a different cache state. Cached data could be inconsistent from one Action to the next, even if it is the same execution.

A workaround to this is putting the code from the second action into that account linking action or to use the Management API like you are already doing.

Best,

Mary Beth