1

I'm using auth0 as my authentification services into my project. I really love it, but I have a problem when using custom database(MySql), I sure that I have configured the db.connection parameter to my remote shared hosting database in Plesk. It always show : "[Error] Script execution did not complete within 20 seconds. Are you calling the callback function?", When I trying to run "Create" script. here the script :

function create (user, callback) {
var mysql      = require('mysql');
var connection = mysql.createConnection({
host     : '192.168.23.16',    
user     : 'user',
password : 'pass',
port     : '3306',
database : 'dbname' });
connection.connect();
var query = "INSERT INTO users SET ?";
var insert = { 
password: bcrypt.hashSync(user.password, 10),
email:    user.email
};
connection.query(query, insert, function (err, results) {
if (err) return callback(err);
if (results.length === 0) return callback();
callback(null);
});
}

What should I'm doing right now to solve this problem? I'm new to this Thanks.. Regards, fxbayuanggara

2
  • Could you post your full script? It's hard to know what's going on with just that snippet. Commented May 26, 2015 at 14:29
  • Hi @RodrigoLópezDato .. I have edited my post with the full script Commented May 26, 2015 at 14:49

1 Answer 1

2

You're trying to connect to a local IP address (192.168.23.16), which will always fail since database scripts and rules are executed from Auth0's servers. You'll need to make your MySQL server accessible from Auth0's IP addresses, which at the time of writing are the following:

  • US domains: 138.91.154.99, 54.221.228.15, 54.183.64.135, 54.67.77.38, 54.67.15.170, 54.183.204.205, 54.173.21.107, 54.85.173.28
  • EU domains: 52.28.56.226, 52.28.45.240, 52.16.224.164, 52.16.193.66
Sign up to request clarification or add additional context in comments.

5 Comments

Okay thanks for your help.. Its help me a lot, and I discovered that the problems is belong to my hosting services that doesn't allowed my database being accessed by public ip(s). Right now I tried to change my service and I will inform you whether its works or not. Thanks
Hey Rodrigo, I've succeed connecting my MySql database server to Auth0. When I try the "create script" it saves the data in my Database. But there was a thing that bothered me, when I try the create Api -> POST myapp.auth0.com/api/users .. its always fail and shows errors : "Users API - Status Code: 500", but the data are saved in my database. What do you think about this?
Could you send the full script and error message to [email protected]? I can follow up there. This isn't really the correct place to continue this discussion. Thanks!
hey.. it has been solved, my bad.. I have choose a wrong back-end services for my app-API. Thanks!..
Hi @data. I got same problem here and I not clearly understand your solution. Can you give me an exactly example to connect to mysql server with auth0?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.