Error prevents app_metadata update in Rule

I am unable to add app_metadata to a user using a Rule. I attempted to use the boilerplate code I found here in the docs:

function (user, context, callback) {
  user.app_metadata = user.app_metadata || {};
  // update the app_metadata that will be part of the response
  user.app_metadata.test = "test!";

  // persist the app_metadata update
  auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
    .then(function(){
      callback(null, user, context);
    })
    .catch(function(err){
      callback(err);
    });
}

I receive the following error:

ERROR: The user does not exist.

What am I doing wrong here?

1 Like

Update: This only seems to be an error when testing the rule. The rule does seem to work correctly when users authenticate.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.