User_metadata is not available during signup first login from last 1 week

We set some user attributes during the signup process using the following PreUserRegistration code.

exports.onExecutePreUserRegistration = async (event, api) => {
  

  const user = event.user;
  
  if (!user.email) {
    api.access.deny("missing_information", "Please enter mandatory details.");
  } else {
    
    try {
      // register user
      const onboardingAPIUrl = `xxx`;
      const onboardingObj = await axios.post(onboardingAPIUrl, params);

      if (onboardingObj && onboardingObj.data) {
        api.user.setUserMetadata("user_id", onboardingObj.data.user_id);
        api.user.setUserMetadata(
          "organization_id",
          onboardingObj.data.organization_id
        );
        api.user.setUserMetadata(
          "display_name",
          onboardingObj.data.display_name
        );
      } else {
        api.access.deny(
          "onboarding_error1",
          "System error. Please contact administrator."
        );
      }
    } catch (error) {
      api.access.deny(
        "onboarding_error2",
        "System error. Please contact administrator."
      );
    }
  }
};

In the Login flow, we set the custom claim with user_metadata

exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'xxxx';
  if (event.authorization) {
    api.accessToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
    api.idToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
  }
}

For the last few days, we have been getting empty custom claims for ${namespace}/user_metadata during the signup - first login only.

As soon as we refresh the screen or do a second login we get the user_metadata as before.

Is there any recent change that happened in the signup or login flow?

Can someone help me understand?

Hi @deepak.kyro,

Welcome to the Auth0 Community!

There haven’t been any recent changes that would impact the signup or login flow.

Now, can you please use the Realtime Webtask Logs extension with console.log()statements to verify that your Pre-User Registration and Post-Login Action scripts are functioning correctly on execution?

From what I have gathered from your scripts, the custom claims should be set on login. That script looks correct.

Thanks,
Rueben

Hi @rueben.tiow

Thanks for your suggestion. We have already done the suggestion actions with no success.

Thanks
Deepak Goyal

Hi @deepak.kyro,

Thanks for the response.

Could you please clarify what you mean by “no success”?

What did you find during your tests with the Real-time Webtask logs extension?