Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tedious mssql connect error #10215

Closed
jelhub opened this issue Apr 12, 2024 · 2 comments
Closed

tedious mssql connect error #10215

jelhub opened this issue Apr 12, 2024 · 2 comments
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@jelhub
Copy link

jelhub commented Apr 12, 2024

What version of Bun is running?

1.1.3+2615dc742

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

Running latest version of bun for windows (v1.1.3)

Using package tedious for mssql connect and queries.

Tedious connects and runs fine using nodejs, but unable to connect when using bun.
Please also see this issue in relation to #5147

How to reproduce connect error:

bun init -y
bun add tedious

index.js:

import { Connection } from 'tedious'

const connection = new Connection(
  {
    server: 'MyServer',
    authentication: {
      type: 'default',
      options: { userName: 'sa', password: 'password' }
    },
    options: {
      instanceName: '',
      port: 1433,
      database: 'MyDatabase',
      useColumnNames: true,
      rowCollectionOnRequestCompletion: true,
      encrypt: false
    }
  }
)

connection.on('connect', function (err) {
  if (err) {
    console.log('connect error: ', err)
    return
  }
  console.log('connect OK')
  connection.close()
})

// Initialize the connection.
connection.connect()

Test using nodejs

node index.js
connect OK

Test using bun (hanging for a while before any output):

bun index.js

connect error:  4 |   value: true
5 | });
6 | exports.RequestError = exports.ConnectionError = void 0;
7 | class ConnectionError extends Error {
8 |   constructor(message, code) {
9 |     super(message);
        ^
error: Failed to connect to MyServer:1433 in 15000ms
 code: "ETIMEOUT"

      at new ConnectionError (C:\temp\xx\node_modules\tedious\lib\errors.js:9:5)
      at connectTimeout (C:\temp\xx\node_modules\tedious\lib\connection.js:1207:26)
      at C:\temp\xx\node_modules\tedious\lib\connection.js:1152:7

4 |   value: true
5 | });
6 | exports.RequestError = exports.ConnectionError = void 0;
7 | class ConnectionError extends Error {
8 |   constructor(message, code) {
9 |     super(message);
        ^
error: Connection lost - unexpected end of message stream
 code: "ESOCKET"

      at new ConnectionError (C:\temp\xx\node_modules\tedious\lib\errors.js:9:5)
      at socketError (C:\temp\xx\node_modules\tedious\lib\connection.js:1342:26)
      at C:\temp\xx\node_modules\tedious\lib\connection.js:2217:18

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@jelhub jelhub added the bug Something isn't working label Apr 12, 2024
@Electroid Electroid added the node.js Compatibility with Node.js APIs label Apr 12, 2024
@jelhub
Copy link
Author

jelhub commented May 3, 2024

FYI,
Fails on Windows
Connect OK on Linux

@jelhub
Copy link
Author

jelhub commented May 22, 2024

Problem fixed in version 1.1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

2 participants