Geting Error Trying to connect with SQL Server Custom Database


Trying to connect to already existing identity database of users , using Auth0 template below, with correct details but getting the error
Cannot find module ‘tedious@1.11.0’ Require stack: - /data/io/node18/6fc65ba9-6164-4708-ae14-1de6ff7f9009/webtask.js, not really sure what it means?

function login(email, password, callback) {
  //this example uses the "tedious" library
  //more info here:
  const bcrypt = require('bcrypt');
  const sqlserver = require('tedious@1.11.0');

  const Connection = sqlserver.Connection;
  const Request = sqlserver.Request;
  const TYPES = sqlserver.TYPES;

  const connection = new Connection({
    userName:  'test',
    password:  'test',
    server:    'localhost',
    options:  {
      database: 'mydb'

  const query = 'SELECT Id, Nickname, Email, Password FROM dbo.Users WHERE Email = @Email';

  connection.on('debug', function (text) {
  }).on('errorMessage', function (text) {
    console.log(JSON.stringify(text, null, 2));
  }).on('infoMessage', function (text) {
    console.log(JSON.stringify(text, null, 2));

  connection.on('connect', function (err) {
    if (err) return callback(err);

    const request = new Request(query, function (err, rowCount, rows) {
      if (err || rowCount < 1) return callback(err || new WrongUsernameOrPasswordError(email));, rows[0][3].value, function (err, isValid) {
        if (err || !isValid) return callback(err || new WrongUsernameOrPasswordError(email));

        callback(null, {
          user_id: rows[0][0].value,
          nickname: rows[0][1].value,
          email: rows[0][2].value

    request.addParameter('Email', TYPES.VarChar, email);

Hi @libra_dn,

Welcome to the Auth0 Community!

That error suggests that it’s not able to load the tedious module. I would suggest picking a version that is available. Here’s a way to find what is available for your runtime:

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