Hello, friends!
I am attempting to utilize an Auth0 Action to set up a POST call whereby after a user logs in on my webapp (in this case using LinkedIn), their email address is automatically passed to an external PostgreSQL database that I control. I set up the PostgresQL database and have tested POST actions to it using a cURL command, which works perfectly fine:
curl --data “email=sampleEmail@gmail.com” http://aaa.ngrok.io/users
However, when using an Axios call via Auth0 action in test mode, I cannot get things to work. I always get the error:
“error: null value in column “email” of relation “users” violates not-null constraint”
detail: ‘Failing row contains (null).’,
… and then my PostgresQL database crashes.
I have searched online and tried almost everything I can think of, including adding headers to Axios, and playing around with variations of the code, but nothing seems to work.
Does anyone have any idea why a cURL POST request would work but an Axios call via Auth0 Actions wouldn’t ? For reference, here is my Axios Action POST call below (which should be triggered after a successful login, but this is irrelevant since the call doesn’t even work under manual test conditions?):
const axios = require(“axios”);
exports.onExecutePostUserRegistration = async (event) => {
const body = { email: event.user.email }
await axios.post(“http://aaa.ngrok.io/users”, body);
};
Thanks and Best,