Snowflake-Labs / sqltools-snowflake-driver

A Snowflake driver for the SQLTools VSCode extension.
MIT License
35 stars 15 forks source link

EXTERNALBROWSER connections generate incorrect URL for US West (Oregon) accounts. #26

Closed Qwertronix closed 3 years ago

Qwertronix commented 3 years ago

Users in the Oregon US West region do not have a "region" segment in their connection URL / account locator string, as per https://docs.snowflake.com/en/user-guide/admin-account-identifier.html

The extension driver appears to be attempting to add a region even in these situations, with what appears to be unintended slicing behavior when there's no . to be found in the account name, duplicating the account name as a "region":

[1615828978177] INFO  (ls): Connection instance created for Myconn.
    ns: "conn-manager"
(node:22336) UnhandledPromiseRejectionWarning: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: myaccount.myaccount.snowflakecomputing.com. is not in the cert's altnames: DNS:*.us-west-2.snowflakecomputing.com, DNS:*.snowflakecomputing.com, DNS:*.global.snowflakecomputing.com, DNS:*.prod1.us-west-2.aws.snowflakecomputing.com, DNS:*.prod2.us-west-2.aws.snowflakecomputing.com, DNS:*.us-west-2.aws.snowflakecomputing.com
    at Object.checkServerIdentity (tls.js:287:12)
    at TLSSocket.onConnectSecure (_tls_wrap.js:1511:27)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket.EventEmitter.emit (domain.js:483:12)
    at TLSSocket._finishInit (_tls_wrap.js:936:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12)
(node:22336) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 45)
koszti commented 3 years ago

Thanks for the report and the PR.

New version (0.4.1) is published to VSCode Marketplace and it should be now ready to upgrade in your VSCode.

koszti commented 3 years ago

:wave: @Qwertronix can you please confirm if it's working after you upgraded to 0.4.1?

Qwertronix commented 3 years ago

@koszti Yep, things are up and running now, with no new errors. Thanks!