snowflakedb / snowflake-connector-nodejs

NodeJS driver
Apache License 2.0
125 stars 132 forks source link

SNOW-1802627: deprecated region property in connection config must still be specified. #960

Closed AubieDawg92 closed 1 week ago

AubieDawg92 commented 1 week ago

If you need urgent assistance then file a case with Snowflake Support. Otherwise continue here.

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.15.0

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

  3. What version of NodeJS are you using? (node --version and npm --version) 16.20.2 8.19.4

  4. What are the component versions in the environment (npm list)? +-- @types/mocha@10.0.9 +-- @types/mssql@9.1.5 +-- @types/node@22.9.0 +-- @types/q@1.5.8 +-- @types/retry@0.12.5 +-- axios-debug-log@1.0.0 +-- azure-devops-node-api@14.1.0 +-- azure-pipelines-task-lib@4.17.3 +-- mssql@11.0.1 +-- snowflake-sdk@1.15.0 +-- sync-request@6.1.0 `-- typed-rest-client@2.1.0

  5. What did you do?

    If possible, provide a recipe for reproducing the error. A complete runnable program would be the most helpful.

    I configured a connection as such: let connection = snowflake.createConnection({ account: "{my_snowflake_account}", host: "{account}.{aws_region}.snowflakecomputing.com", warehouse: "{warehouse_name", role: "{role}", username: userName, password: password, authenticator: "{okta_authenticator_url}", database: "{database}", schema: "{schema}", });

  6. What did you expect to see?

    What should have happened and what happened instead?

    I should have made a connection to snowflake

  7. Can you collect debug logs?

I did collect logs. The relevant error was:

{"level":"INFO","message":"[9:38:42.241 AM]: Connection[id: 9fcb8b52-0525-4fc0-82f5-ebfe4e8bc1cf] - failed to connect async after 939.9255000054836 milliseconds.Failed during authentication. Error: AxiosError: Request failed with status code 404\n at settle (C:\src\PipelineTasks\node_modules\axios\dist\node\axios.cjs:2019:12)\n at IncomingMessage.handleStreamEnd (C:\src\PipelineTasks\node_modules\axios\dist\node\axios.cjs:3135:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358"} {"level":"ERROR","message":"[9:38:42.242 AM]: Connection[id: 9fcb8b52-0525-4fc0-82f5-ebfe4e8bc1cf] - failed during authentication. Error: AxiosError: Request failed with status code 404\n at settle (C:\src\PipelineTasks\node_modules\axios\dist\node\axios.cjs:2019:12)\n at IncomingMessage.handleStreamEnd (C:\src\PipelineTasks\node_modules\axios\dist\node\axios.cjs:3135:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/"}

After additional debugging, I was able to determine that the endpoint that axios was trying to connect to was the host string with the region removed. Once I specified the region property (deprecated) on the connection config then it worked.

:warning: Before sharing any data, please be sure to review the log and remove any sensitive information.

sfc-gh-dszmolka commented 1 week ago

hello - i'm able to connect with

const connection = snowflake.createConnection({
    validateDefaultParameters: true,
    account: process.env.SFLOCATOR,
    host: process.env.SFLOCATOR + '.eu-central-1.snowflakecomputing.com',
    username: process.env.SFUSER,
    password: process.env.SFPASS,
    application: __filename.slice(__dirname.length + 1)
});

for an account in AWS EU Frankfurt, where SFLOCATOR is xy12345 , the account locator name. So no bug here, but looks like a misconfiguration of the account name.

Recommendation is to either use the regionless notation ORGNAME-ACCOUNTNAME for account, or the older, locator version accountlocator.yourregion (where region is needed, and sometimes cloud notation is also needed, see https://docs.snowflake.com/en/user-guide/admin-account-identifier)

host is not necessary if you have account properly populated, see https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-connect#creating-a-single-connection

Since this works as expected and per documentation, I'm marking it as closed but if you have evidence (logs) of an actual error which doesn't happen due to a misconfiguration, please do share and I can reopen and look further.