Post-Registration action fails causing user to not be created

I have an action for Post-Registration, that sends me the user’s auth0 id and email so I can then store them in my database. Sometimes the action fails, but I still get the user in my database with an auth0 id and email, but they do not show up in Auth0. I am confused on how this occurs. Shouldn’t the action only run after the user has been registered in Auth0?

Hi @jordansh,

Thanks for reaching out to the Auth0 Community!

Yes, the Post-User Registration Action executes after a user successfully registers onto your application.

Given that the issue happens intermittently, could you please clarify the error logs you get when the Action fails?

And could you please share your complete Post-User Registration Action script?

Thank you.

const axios = require('axios');

exports.onExecutePostUserRegistration = async (event) => {
  const response = await axios.post('<api endpoint>', {
    auth0Id: event.user.user_id,
    email: event.user.email,
    key: xxxxxx
  })
};

That is the action I run on the Post User Registration Flow.

I don’t see any error logs on my backend, and I cannot look back far enough in Auth0 for the error since I only get 24 hours of logs.

Hi @jordansh,

Thank you for your response.

There is nothing alarming about in your code. In this situation, could you please let me know if this issue is 100% reproducible?

Thank you.

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!