Auth0 Home Blog Docs

Custom database scripts not working properly

custom-database

#1

I have two scripts setup:

GetByEmail:

function getByEmail (email, callback) {
var request = require(‘request’);
//console.log(email);
request.get(
http://api.xxxx.com/users?email=”+email,
function (err, response, body) {
if(err) {
return callback(new Error(err));
}
if(response.statusCode !== 200) {
return callback(new Error(body));
}
callback(null, {
user_id: 123456789,
email: email
});
}
);
}

This one works great.

Then I try to implement custom Create:

function create (user, callback) {
console.log(‘hiiiii’);
callback(null, {});
}

This one has problems. It keeps saying Error. According to wt console sending logs, the GetByEmail script is being sent properly with 200 HTTP code, but then next should be run the create script and it isnt.

Please, can you help me with this case?