Auth0 Home Blog Docs

[Custom Database] Create script is never read (while all other scripts work)

custom-database
auth0-create-user

#1

Hi there,

I’ve read the other topics on the subject and here is what I did already:

  1. took a new browser to refresh (cached scripts? contents?) : It actually got one script working with this solution.
  2. added some console.logs to check out from the Test Script AND from the webtask console logs live output: Helped me to see that only the create script isn’t working at all. There is a console.log on the first line and this isn’t even read :confused:
  3. checked the scripts on local env and works like a charm

Here is how my create script look:

function create(user, callback) {
  console.log("Calling create()");
  request({
      url: "https://endpoint.com/to/somewhere",
      method: "POST",
      body: { user },
      qs: { SECURE: configuration.SECURE_KEY },
      json: true
    },
    function(err, res, body) {
      if (body.ok) return callback(null, body.data);
      callback(err, res);
    }
  );
}

and this is the result:

Any idea how to make it work?

Thanks for you help,
Gabin


#2

After 2 days of research I finally got the issue… my getUser script when not finding any was sending back an error when the callback should be empty of arguments.

Meaning that you should return callback() when finding no existing user!