# getUser is called before create

**URL:** <https://community.auth0.com/t/getuser-is-called-before-create/10614>\
**Category:** Get Help\
**Tags:** custom-database\
**Created:** [April 4, 2018, 12:58am UTC](https://community.auth0.com/t/getuser-is-called-before-create/10614 "2018-04-04T00:58:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent.desmares](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vincent.desmares/32/9932_2.png) [@vincent.desmares](https://community.auth0.com/u/vincent.desmares)\
**Post date:** [April 4, 2018, 12:58am UTC](https://community.auth0.com/t/getuser-is-called-before-create/10614/1 "2018-04-04T00:58:47Z")

</div>

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

It was already reported here: [Try-create script not working - #3 by anthony.r.dipasquale](http://community.auth0.com/t/try-create-script-not-working/7743/3), 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.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [April 4, 2018, 9:52am UTC](https://community.auth0.com/t/getuser-is-called-before-create/10614/2 "2018-04-04T09:52:51Z")

</div>

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 ([Custom Database Connections](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.

---

<div class="post-metadata">

**Author:** ![vincent.desmares](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vincent.desmares/32/9932_2.png) [@vincent.desmares](https://community.auth0.com/u/vincent.desmares)\
**Post date:** [April 4, 2018, 3:27pm UTC](https://community.auth0.com/t/getuser-is-called-before-create/10614/3 "2018-04-04T15:27:33Z")

</div>

Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 25, 2019, 12:39pm UTC](https://community.auth0.com/t/getuser-is-called-before-create/10614/4 "2019-07-25T12:39:09Z")

</div>

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