I can run this without problem in the in the editor, but when I create a new user through the Auth0 dashboard, it doesn’t work. All I get in Logs is a Warning: ExtensibilityImplementationError on post-user-registration: Script generated an unhandled asynchronous exception.
Here’s my hook code:
var request = require('request@2.82.0');
module.exports = function (user, context, cb) {
const url = 'https://url-where-I-post-my-user';
request({
method: 'POST',
url: url,
json: true,
body: {
"user_id": user.user_id,
"username": user.username,
"role": user.app_metadata.role,
"first_name": user.app_metadata.first_name,
"last_name": user.app_metadata.last_name
},
},
function(error, response, body) {
cb(error, response)
});
};