Auth0 Home Blog Docs

getUser is called before create

custom-database

#1

getUser(byEmail) is called before the create script for custom databases.

It was already reported here: try-create script not working, but it looks like it’s still missing from the documentation.

I advise to add a small sentence after the “This script will be executed when the user signs up.” description.

What’s the expected return of getUser when no user matches? I now return null instead of an error (I tried both string and Object errors, they all block the call to create).

I just want to make sure that we following the Auth0’s best practices.


#2

For the expected response it is indeed expected to return null in that scenario so your current implementation is correct; the expectations of each script in terms of responses can be found in the comments available above the placeholder implementation when you create the script.

In relation to the docs issue there is a note at (https://auth0.com/docs/connections/database/custom-db#create-database-action-scripts) that mentions this situation about the get user script being called before the create for signups.


#3

Thank you very much!