Auth0 Home Blog Docs

Rules order doesn't seems to be working



I am migrating my users from one tenant to another on Login. There are two rules used in the process to add users to group and role(Authorization extension) and to update app_metadata with group and role. But it doesn’t run in order.
I have placed few console.logs to check the order. First logs in both the rules comes first. It seems both runs asynchronously.
And there is this third rule which adds groups and roles to id_token and access_token. Because these doesn’t run in order so I don’t get groups and source in id_token, which fails my application.
What can be the possible problem. I am not sure what’s causing the issue?