Custom database script fails with socket hang up error

I would like to use a custom db (mysql) to store the users. I have setup the custom db provider, then added the necessary scripts.

I clicked “Try connection”, switched to signup tab, entered the data. The row is created successfully, but the signup form throw an error. I see the following in the logs

"description": "Error: socket hang up\n at createHangUpError (_http_client.js:211:15)\n at Socket.socketOnEnd (_http_client.js:303:23)\n at emitNone (events.js:72:20)\n at Socket.emit (events.js:166:7)\n at endReadableNT (_stream_readable.js:913:12)\n at nextTickCallbackWith2Args (node.js:442:9)\n at process._tickDomainCallback (node.js:397:17)"

Anyone has experienced such an issue?

This could possibly happen if your scripts perform network-based asynchronous operations and during those operations there are additional logic that runs and throws unhandled errors within your script. The unhandled error could be causing an issue with the in-progress network operations.

With custom database script or rules you need to be careful to always call the callback function as expected and that there are also no unhandled errors. A quick way to troubleshoot your scripts/rules is to use console.log statements and review the generated logs.