Auth0 Home Blog Docs

Pre-Registration hook not working with API Call

hooks
api-authorization

#1

I created a pre-registration hook, was able to test in the sandbox without errors. However when I try to register a user from my actual application it fails with a generic message:

{
  "name": "InternalExtensibilityError",
  "statusCode": 500,
  "code": "server_error",
  "message": "Internal server error",
  "fromSandbox": true
}

Hook code:

var response = {};
  if (user.user_metadata.cmsName && user.user_metadata.cmsPw) {
     var ownerId = 1;
     var oemName = "Test";
     response.user = {
      user_metadata: { facilitycode: user.user_metadata.facilitycode, ownerId: ownerId, oemName: oemName}
    };
  } else {
    return cb('Invalid Signup');
  }
  response.user = user;
  cb(null, response);

#2

Can you clarify where you see that error, e.g. In the Webtask editor logs? If so, a bug was recently fixed where the hook would still run fine, however the error would show up in the editor. You can try copying the Hook code, deleting the Hook from the dashboard, re-creating a new Hook, and paste the code.


#3

This was fixed after the bad mac error was fixed


#4

@ e.alic I am facing the same issue but I don’t understand form your reply what was the fix. Could you please give a hand? Many thanks


#5

@ e.alic I am facing the same issue but I don’t understand form your reply what was the fix. Could you please give a hand? Many thanks


#6