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-1855886: HTTP 404 when Config.Account field includes us-west-2 region #1275

Open
nathanjcochran opened this issue Dec 12, 2024 · 2 comments
Assignees
Labels
enhancement The issue is a request for improvement or a new feature status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@nathanjcochran
Copy link

nathanjcochran commented Dec 12, 2024

  1. What version of GO driver are you using?

    v1.11.2

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

    Linux, amd64

  3. What version of GO are you using?

    1.23.2

  4. Server version:

    8.46.1

  5. What did you do?

    Attempted to connect to a Snowflake instance located in the us-west-2 region by specifying an Account field in the Config struct that included the .us-west-2 as the region, and then connect via NewConnector:

    package main
    
    import (
    	"database/sql"
    	"fmt"
    
    	"github.com/snowflakedb/gosnowflake"
    )
    
    func main() {
    	config := gosnowflake.Config{
    		Account:   "my-account-id.us-west-2", // Source of the bug
    		Database:  "MY_DATABASE",
    		Warehouse: "MY_WAREHOUSE",
    		Role:      "MY_ROLE",
    		User:      "MY_USER",
    		Password:  "MY_PASSWORD",
    	}
    	driver := &gosnowflake.SnowflakeDriver{}
    	connector := gosnowflake.NewConnector(driver, config)
    	db := sql.OpenDB(connector)
    	if err := db.Ping(); err != nil {
    		fmt.Println(err)
    	}
    }

    This prints an error like the following (even with otherwise valid configuration parameters):

    261004 (08004): failed to auth for unknown reason. HTTP: 404, URL: https://my-account-id.us-west-2.snowflakecomputing.com:443/session/v1/login-request?databaseName=MY_DATABASE&requestId=a7cd0f89-0e11-4f3d-5de6-91dc4e926d60&request_guid=0431eb16-daf4-4bbc-5d95-f1559b03dd0b&roleName=MY_ROLE&warehouse=MY_WAREHOUSE

    You can see that us-west-2 appears in the URL (whereas it's not supposed to).

    If I omit .us-west-2 from the Account field, it works.

  6. What did you expect to see?

    I expected to be able to connect to my Snowflake instance successfully, even when the Account field included .us-west-2.

    The problem appears to be due to the fact that us-west-2 is a special region, and is not supposed to be included in the URL, like other regions. There is already some existing logic in place to handle this in the DSN code path when the region is provided via the Region field (see here). However, there is no such logic when the region is included as part of the Account field, or when connecting directly via the NewConnector code path (without creating a DSN).

    I would expect us-west-2 to always be stripped out if provided, and to not appear in the full URL that gets generated. This is how at least some of the other Snowflake drivers work. For instance, see here in the NodeJS driver - and note that this logic is called after the region is parsed out of the account field, meaning that the region is always correctly stripped out if it's us-west-2, and never appears in the URL. This disparity between driver implementations makes this particularly confusing, because a working config in one language can be broken (with a very confusing error message) in another language.

  7. Can you set logging to DEBUG and collect the logs?

    N/A.

@nathanjcochran nathanjcochran added the bug Erroneous or unexpected behaviour label Dec 12, 2024
@github-actions github-actions bot changed the title HTTP 404 when Config.Account field includes us-west-2 region SNOW-1855886: HTTP 404 when Config.Account field includes us-west-2 region Dec 12, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added enhancement The issue is a request for improvement or a new feature status-triage_done Initial triage done, will be further handled by the driver team and removed bug Erroneous or unexpected behaviour labels Dec 13, 2024
@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Dec 13, 2024

hi - we can consider this an enhancement, handling user-originated misconfiguration more gracefully.

This is one, a misconfiguration, since for AWS US WEST 2 (which is also indeed special; the default region), the only two accepted account notations are the following, demonstrating through an example where the account locator is xy12345, account name is devtest, and organization name is myorg (thus, full snowflake URLS are: myorg-devtest.snowflakecomputing.com (regionless) or xy12345.snowflakecomputing.com (older, locator)

Only valid account values:

  • the newer, regionless notation: myorg-devtest
  • the older, locator notation: xy12345

No other account name notations are considered a valid configuration, regardless of whether they work or not :)
Please see Account Identifiers Snowflake documentation for more details.

We'll consider this item as an enhancement to the driver.

@sfc-gh-dszmolka sfc-gh-dszmolka added the status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. label Dec 18, 2024
@sfc-gh-dszmolka
Copy link
Contributor

addressed in #1278, awaiting release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is a request for improvement or a new feature status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

3 participants