Trying to test a custom action from within the "Custom Actions" Development page. This used to work, and now all of the

Trying to test a custom action from within the “Custom Actions” Development page. This used to work, and now all of the sudden, it is failing.

This is the error that is being returned. Looks like it is coming from Auth0 and not my code.

Error:
{
“message”: “Request failed with status code 500”,
“name”: “Error”,
“stack”: “Error: Request failed with status code 500\n at createError (/data/_verquire/_node16/axios/0.22.0/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/data/_verquire/_node16/axios/0.22.0/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/data/_verquire/_node16/axios/0.22.0/node_modules/axios/lib/adapters/http.js:293:11)\n at IncomingMessage.emit (node:events:539:35)\n at IncomingMessage.emit (node:domain:537:15)\n at endReadableNT (node:internal/streams/readable:1345:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)”
}

This is the code for the custom action:

/**

  • Handler that will be called during the execution of a PostUserRegistration flow.
  • @param {Event} event - Details about the context and user that has registered.
    */
    exports.onExecutePostUserRegistration = async (event, api) => {

const axios = require(‘axios’);
const https = require(‘https’);
const MY_CA_BUNDLE = event.secrets.CA_Bundle;

const httpsAgent = new https.Agent({
rejectUnauthorized: false
});
const instance = axios.create({ httpsAgent })

const url = ‘https://MY_URL/tester2/api/PostAuth0?emailAddress=’ + event.user.email + ‘&auth0Id=’ + event.user.user_id + ‘&emailverified=’ + event.user.email_verified + ‘&’;
‘&userMetadata=’ + event.user.user_metadata + ‘&’;

const options = {
headers: {
‘Content-Type’: ‘application/json’
}
};

const data = {

emailAddress: event.user.email

};

var response = await instance.post(url, data, options);
console.log(response.data);
};

I am down right now, can you help me figure it out. Thanks!

I was to fix the issue it was a JSON.stringify issue.

1 Like

Hey @neel welcome to the community and thanks for following up with the solution :pray: :white_check_mark:

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