Auth0 Home Blog Docs

Own db connection

Hi,
I am using auth0’s custom DB connection. with its “own custom DB feature”.
I am trying to connect my local DB with it. with the help of ngrok.
On click of TRY link, the below error is showing.
“[SandboxUnhandledError] MySQL is not a function”.
And in the Real-time webtask. the below message is showed.
{
“code”: 500,
“error”: “Script generated an unhandled synchronous exception.”,
“details”: “TypeError: mysql is not a function”,
“name”: “TypeError”,
“message”: “mysql is not a function”,
“stack”: “TypeError: mysql is not a function\n at getByEmail (/data/io/c6efb891-6882-4a64-b906-d9471f16da8f/webtask.js:9:22)\n at /data/io/c6efb891-6882-4a64-b906-d9471f16da8f/webtask.js:31:2\n at Async.waterfall (/data/sandbox/lib/sandbox.js:617:33)\n at nextTask (/data/sandbox/node_modules/async/dist/async.js:5324:14)\n at next (/data/sandbox/node_modules/async/dist/async.js:5331:9)\n at /data/sandbox/node_modules/async/dist/async.js:969:16\n at Async.waterfall (/data/sandbox/lib/sandbox.js:506:24)\n at nextTask (/data/sandbox/node_modules/async/dist/async.js:5324:14)\n at next (/data/sandbox/node_modules/async/dist/async.js:5331:9)\n at /data/sandbox/node_modules/async/dist/async.js:969:16”
}
plz guide me…

You should share the custom database script code (redacting any sensitive information like URL, passwords, etc); ideally you should not even have those in the code and use configuration variables, but since you’re starting the implementation you may still have those in code, hence the warning.

The error seems related to the Javascript code itself, in particular with the usage of a module to connect to MySQL. We have templates for MySQL available at (https://auth0.com/docs/connections/database/custom-db/templates/login#mysql); are you using those as reference already?

yes, i am using those ref.
I am using the mysql readymade templates with own custom DB.
const connection = mysql({
host: ‘d2c6ec27.ngrok.io’, //host which is ngrok link to my local pc
user: ‘root’, //username
password: ‘’, //password is blank
port :‘3306’, //port
database: ‘hotstarapp’ //db name
});
when i am clicking on TRY button the error is showing while creating a user.
and also sometimes it shows following error.
“[Error] ETIMEDOUT - connect ETIMEDOUT”
i have also checked it with Realtime weblog.
which is showing below
{
“code”: 500,
“error”: “Script generated an unhandled synchronous exception.”,
“details”: “TypeError: mysql is not a function”,
“name”: “TypeError”,
“message”: “mysql is not a function”,
“stack”: “TypeError: mysql is not a function\n at getByEmail (/data/io/c6efb891-6882-4a64-b906-d9471f16da8f/webtask.js:9:22)\n at /data/io/c6efb891-6882-4a64-b906-d9471f16da8f/webtask.js:31:2\n at Async.waterfall (/data/sandbox/lib/sandbox.js:617:33)\n at nextTask (/data/sandbox/node_modules/async/dist/async.js:5324:14)\n at next (/data/sandbox/node_modules/async/dist/async.js:5331:9)\n at /data/sandbox/node_modules/async/dist/async.js:969:16\n at Async.waterfall (/data/sandbox/lib/sandbox.js:506:24)\n at nextTask (/data/sandbox/node_modules/async/dist/async.js:5324:14)\n at next (/data/sandbox/node_modules/async/dist/async.js:5331:9)\n at /data/sandbox/node_modules/async/dist/async.js:969:16”
}
i am a biginner so very confusing me. plz do help ASAP.

Hi @jmangelo,
Now i have encounter with this error.
“401 - Unauthorized”
Plz do reply.

If you haven’t done so already you should check (Custom database error - "mysql is not a function"?) which has some relevant information from someone that experienced similar issues.

1 Like