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

SNOW-1446128: Unexpected error from calling callback function TypeError: this.constructExponentialBackoffStrategy is not a function. #845

Closed
nbbaier opened this issue May 24, 2024 · 3 comments
Assignees
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team wontfix This will not be worked on

Comments

@nbbaier
Copy link

nbbaier commented May 24, 2024

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of NodeJS driver are you using?
    1.10.1

  2. What operating system and processor architecture are you using?

Darwin RMT-MLT-DWANG.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
  1. What version of NodeJS are you using?
    I'm using bun

  2. What are the component versions in the environment (npm list)?

@types/[email protected]
@types/[email protected]
[email protected]
[email protected]
[email protected]

6. What did you do?

I'm trying to run the following code:

```typescript
// index.ts
import * as snowflake from "snowflake-sdk";

snowflake.configure({logLevel : 'TRACE'});

const conn = snowflake.createConnection({
  account: <account>,
  username: <username>,
  warehouse: <warehouse>,
  password: <password>,
  database: <database>,
});

conn.connect(function (err, conn) {
  if (err) {
    console.error("Unable to connect: " + err.message);
  } else {
    console.log("Successfully connected to Snowflake.");
  }
});

And get the following logs:

{"level":"INFO","message":"[11:18:37.960 PM]: Trying to initialize Easy Logging"}
{"level":"INFO","message":"[11:18:37.975 PM]: No client config file found in default directories"}
{"level":"INFO","message":"[11:18:37.976 PM]: Easy Logging is disabled as no config has been found"}
{"level":"DEBUG","message":"[11:18:37.976 PM]: 300"}
{"level":"DEBUG","message":"[11:18:37.977 PM]: Contacting SF: /session/v1/login-request?requestId=9e60da7f-ba7b-4e56-befc-a9abf18ce6b0&warehouse=BI_DS_VWH&databaseName=BI_DWH_PROD, (0/7)"}
{"level":"ERROR","message":"[11:18:37.980 PM]: Unexpected error from calling callback function TypeError: this.constructExponentialBackoffStrategy is not a function. (In 'this.constructExponentialBackoffStrategy()', 'this.constructExponentialBackoffStrategy' is undefined)\n    at prepareRequestOptions (/Users/nicholasbaier/Library/CloudStorage/[email protected]/Shared drives/Cx Data Team Core/NB_working-data/working-code/experiments/node_modules/snowflake-sdk/lib/http/base.js:212:20)\n    at <anonymous> (/Users/nicholasbaier/"}
  1. What did you expect to see?
Successfully connected to Snowflake.
  1. Can you set logging to DEBUG and collect the logs? same as above
@nbbaier nbbaier added the bug Something isn't working label May 24, 2024
@github-actions github-actions bot changed the title Unexpected error from calling callback function TypeError: this.constructExponentialBackoffStrategy is not a function. SNOW-1446128: Unexpected error from calling callback function TypeError: this.constructExponentialBackoffStrategy is not a function. May 24, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this May 24, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label May 24, 2024
@sfc-gh-dszmolka
Copy link
Collaborator

thanks for reporting this, will take a look

@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented May 24, 2024

import * as snowflake from "snowflake-sdk";
const sf = snowflake.default;
sf.configure({logLevel : 'TRACE'});


const conn = sf.createConnection({
  account: process.env.SFACCOUNT,
  username: process.env.SFUSER,
  password: process.env.SFPASS
});

conn.connect(function (err, conn) {
  if (err) {
    console.error("Unable to connect: " + err.message);
  } else {
    console.log("Successfully connected to Snowflake.");
  }
});

works perfectly on node for which runtime the driver is intended for:

# npx tsx index.ts
{"level":"INFO","message":"[7:58:51.753 AM]: Trying to initialize Easy Logging"}
{"level":"INFO","message":"[7:58:51.777 AM]: No client config file found in default directories"}
{"level":"INFO","message":"[7:58:51.778 AM]: Easy Logging is disabled as no config has been found"}
{"level":"DEBUG","message":"[7:58:51.781 AM]: 300"}
{"level":"DEBUG","message":"[7:58:51.783 AM]: Contacting SF: /session/v1/login-request?requestId=8b7c54a7-[..]a2224, (0/7)"}
{"level":"TRACE","message":"[7:58:51.789 AM]: Create and add to cache new agent https://myaccount.snowflakecomputing.com-keepAlive"}
{"level":"DEBUG","message":"[7:58:51.789 AM]: Proxy settings used in requests: none."}
{"level":"TRACE","message":"[7:58:51.790 AM]: CALL POST with timeout 90000: https://myaccount.snowflakecomputing.com/session/v1/login-request?requestId=8b7c54a7-[..]a2224"}
{"level":"TRACE","message":"[7:58:52.017 AM]: socket reused = false"}
{"level":"DEBUG","message":"[7:58:52.049 AM]: Reading OCSP cache file. /root/.cache/snowflake/ocsp_response_cache.json"}
{"level":"TRACE","message":"[7:58:52.692 AM]: Returning OCSP status for certificate 0173E8C6BA8A71A96CB18E308725297A from cache"}
{"level":"TRACE","message":"[7:58:52.790 AM]: Returning OCSP status for certificate 0773124CD406D267C0991CDD299A9F38317985 from cache"}
{"level":"TRACE","message":"[7:58:52.863 AM]: Returning OCSP status for certificate 067F944A2A27CDF3FAC2AE2B01F908EEB9C4C6 from cache"}
{"level":"TRACE","message":"[7:58:52.879 AM]: Returning OCSP status for certificate A70E4A4C3482B77F from cache"}
{"level":"TRACE","message":"[7:58:52.882 AM]: OCSP validation succeeded for myaccount.snowflakecomputing.com"}
Successfully connected to Snowflake.

it indeed fails to run on bun with the error you mentioned.

At this moment we do not claim compatibility or test against any other framework than node for which the driver is meant to be used and unfortunately I don't have any timeline in the foreseeable future where we would plan to implement bun compatibility I'm afraid.

Closing this issue for now but please do let us know if you have any issue running your code in node.

@sfc-gh-dszmolka sfc-gh-dszmolka added wontfix This will not be worked on status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels May 24, 2024
@nbbaier
Copy link
Author

nbbaier commented May 24, 2024

Thanks, will let you know if I have a problem running in node!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants