Sandbox Error: undefined on creating user

Hi,

I’m stuck trying to create user with the management api.
I get this error: Sandbox Error: undefined on creating user

The description of the error on auth0 dashboard logs is: "Unexpected token C in JSON at position 0"
It does not makes sense to me.

I have a custom database with “Import users to auth0” enabled.
I have no action flow scripts.

Hi @dudumonteiro,

Thanks for reaching out to the Auth0 Community!

I understand that you have encountered issues when creating a user with the Management API.

Before we continue, could you please share your Create a User request?

And, could you please clarify if you are trying to use the Management API to create a user in your custom database?

I look forward to hearing from you.

Thank you.

hi @rueben.tiow ,

thanks for replying.

here is my create user request:
curl -H "Authorization: Bearer {access_token}" -X POST -H "Content-Type: application/json" -d '{"email":"mariay@example.com","given_name":"Maria","family_name":"Silva","name":"Maria Silva","nickname":"mariay","connection":"MigrationDatabase","password":"maria","username":"mariay"}' https://{AUTH0_DOMAIN}/api/v2/users

and yes, I am trying to create a user in my custom database (MigrationDatabase).

Hi @dudumonteiro,

Thank you for your response and clarification.

After reviewing your request, everything looks good. Could you please confirm if you have implemented your Database Action scripts?

And could you please DM your tenant name for me to investigate your settings?

Thank you.

Hi @rueben.tiow ,

The problem was on Get User script.
It wasn’t handling the “404 exception” when user is not found.

1 Like

Hi @dudumonteiro,

Thank you for sharing your solution with the rest of the Community!

Please reach out if you have any other questions.

Thank you.