Custom Database scripts returning "The Profile is: Undefined"

My users are able to login/create when using my app and see their information but when I try to run the scripts in the Auth0 Dashboard they show up as “The Profile is: Undefined”.

This issue is also stopping my users from being able to Verify their email.

I also have 4 extra fields that I have listed in my sign up page: “firstName, lastName, city, cycle”.

This is my get user script.

    function getByEmail(email, callback) {
  const mysql = require('mysql@2.16.0');

  const connection = mysql.createConnection({
    host: configuration.DB_HOST,
    user: configuration.DB_USER,
    password: configuration.DB_PASSWORD,
    database: configuration.DB_NAME,
    ssl: {
       rejectUnauthorized: false,
     }
  });

console.log("Preparing connection to DB...");

  connection.connect();
console.log("Connected to DB: OK!");
  const query = 'SELECT user_id, email, email_Verified FROM users WHERE email = ?';

console.log("Query DB for email: " + email);
  connection.query(query, [ email ], function(err, results) {
console.log("Error???: " + err);
    if (err || results.length === 0) return callback(err || null);
console.log("Query executed OK!");
        console.log("Users found: " + results.length);
    if (results.length === 0) return callback();
    
    const user = results[0];
    callback(null, {
      user_id: user.user_id.toString(),
      email: user.email
    });
  });
}

This is my webtask log when applying my “get user” script

Can you send me the tenant and connection name via DM?

Thanks.

1 Like

Hey Nicolas,

I just send over my auth0 details.

Thanks,
Carlos

Quick update: this was a Dashboard issue, and it’s been fixed already.
Thanks @cvasquez0100 for reporting!

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