[SandboxUnhandledError] mysql is not a function when using custom database

I’ve taken a look at this article and the suggestion solution stopped working for me after a few hours.

I’m attempting to use the MySQL template for creating a user for a custom database.

As suggested, I changed the code to follow the solution.

  function create(user, callback) {
  const mysql = require('mysql');
  const bcrypt = require('bcrypt');

  const connection = mysql.createConnection({
  host: 'xxx',
  user: 'xxx',
  password: 'xxx',
  database: 'xxx'


const query = 'INSERT INTO manager SET ?';

const insert = {
  password: 'hello',
  email: user.email

connection.query(query, insert, function(err, results) {
  if (err) return callback(err);
  if (results.length === 0) return callback();


I’m receiving a [SandboxUnhandledError] mysql is not a function error when using the prompt to test the creation of the user.

I wanted to reach out and see if you were able to overcome this mysql sandbox error @kdesimini? Thanks in advance!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.