bun icon indicating copy to clipboard operation
bun copied to clipboard

snowflake-sdk errors on connect

Open 0xRapid opened this issue 10 months ago • 1 comments

What version of Bun is running?

1.1.2

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Use the following code to get the error (you don't need to change any details inside the create connection object).

import snowflake from 'snowflake-sdk';

(() => {
    var connection = snowflake.createConnection({
        account: "account",
        username: "user",
        password: "password",
        application: "application"
    });
    connection.connect(
        function(err, conn) {
            if (err) {
                console.error('Unable to connect: ' + err.message);
            }
            else {
                console.log('Successfully connected to Snowflake.');
                // Optional: store the connection ID.
            }
        }
    );
})()

What is the expected behavior?

Connection to be established.

What do you see instead?

 Unexpected error from calling callback function TypeError: this.constructExponentialBackoffStrategy is not a function. (In 'this.constructExponentialBackoffStrategy()', 'this.constructExponentialBackoffStrategy' is undefined)\n    at prepareRequestOptions (C:\\Users\\User\\WebstormProjects\\bun\\node_modules\\snowflake-sdk\\lib\\http\\base.js:212:20)\n    at <anonymous> (C:\\Users\\User\\WebstormProjects\\bun\\node_modules\\snowflake-sdk\\lib\\http\\base.js:79:54)\n    at sendHttpRequest (C:\\Users\\User\\Web"}

Additional information

The reproduction is pretty easy as you can see, hopefully this can be solved :).

0xRapid avatar Apr 07 '24 11:04 0xRapid

Stepping through the debugger, it looks like the constructExponentialBackoffStrategy function is set on the prototype, but it's not saved when the code is imported and run later.

https://github.com/snowflakedb/snowflake-connector-nodejs/blob/ec00a1de570bf3be65c3424478c7882b12f1c9d0/lib/http/node.js#L23

Electroid avatar Apr 08 '24 23:04 Electroid

If I am searching for that error btw, "is not a function" it seems to have happened a lot here. (Many issues about it, not specifically just in snowflake-sdk)

0xRapid avatar Apr 10 '24 17:04 0xRapid

Still happens in 1.1.4

0xRapid avatar Apr 19 '24 16:04 0xRapid

Can you add a label "company willing to use bun in production"? @Jarred-Sumner @Electroid

I have written about it in many places, those issues need to get priority, you can check some of the client-list of snowflake, you will understand libraries like this can not be left out of the equation.

0xRapid avatar Apr 25 '24 17:04 0xRapid