# Geting Error Trying to connect with SQL Server Custom Database

**URL:** <https://community.auth0.com/t/geting-error-trying-to-connect-with-sql-server-custom-database/118052>\
**Category:** Get Help\
**Tags:** custom-database-connections, connections\
**Created:** [October 8, 2023, 10:45am UTC](https://community.auth0.com/t/geting-error-trying-to-connect-with-sql-server-custom-database/118052 "2023-10-08T10:45:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![libra\_dn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/libra_dn/32/51504_2.png) [@libra\_dn](https://community.auth0.com/u/libra_dn)\
**Post date:** [October 8, 2023, 10:45am UTC](https://community.auth0.com/t/geting-error-trying-to-connect-with-sql-server-custom-database/118052/1 "2023-10-08T10:45:02Z")

</div>

Hi

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?

```auto
function login(email, password, callback) {
  //this example uses the "tedious" library
  //more info here: http://pekim.github.io/tedious/index.html
  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) {
    console.log(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));

      bcrypt.compare(password, 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);
    connection.execSql(request);
  });
}

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 11, 2023, 5:51pm UTC](https://community.auth0.com/t/geting-error-trying-to-connect-with-sql-server-custom-database/118052/3 "2023-10-11T17:51:49Z")

</div>

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:

[https://auth0-extensions.github.io/canirequire/#tedious](https://auth0-extensions.github.io/canirequire/#tedious)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 25, 2023, 5:52pm UTC](https://community.auth0.com/t/geting-error-trying-to-connect-with-sql-server-custom-database/118052/4 "2023-10-25T17:52:15Z")

</div>

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