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

Intermittent problem with DB connection while using Snowflake and SSO #2742

Closed
ddppi opened this issue Sep 8, 2020 · 7 comments
Closed

Intermittent problem with DB connection while using Snowflake and SSO #2742

ddppi opened this issue Sep 8, 2020 · 7 comments

Comments

@ddppi
Copy link

ddppi commented Sep 8, 2020

Hi,

I am using Window 10 + Anaconda (Python 3.7.6) + DBT (v0.18.0) to access Snowflake.

When I do DBT run, I don't have any problem while using username/password in profiles.yml. However, when I switch to SSO, I always have intermittent problem and the run fails half way, and the error message is

ERROR: Database Error
  250007 (08001): Failed to connect to DB: <account>.snowflakecomputing.com:443, Invalid HTTP request from web browser. Idp authentication could have failed.

In the web browser, I can see the page opens up site
https://.snowflakecomputing.com/fed/login
saying
Redirecting to Snowflake client in 1 seconds...
, then the site is redirected to
http://localhost:/?token=
but I gets the error message on the webpage saying
This site can't be reached

My colleagues seem to get the same problem. Any suggestions, or what information could be helpful to trace the problem?

thanks,

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2020

Thanks for opening @ddppi. We've been seeing some issues lately with Snowflake + browser auth.

Have you turned on the allow_id_token parameter in your Snowflake account (docs)?

@ddppi
Copy link
Author

ddppi commented Sep 8, 2020 via email

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2020

Hmm. I don't know that this would be the culprit, but it's worth saying that we've pinned snowflake-connector-python==2.2.10 here, and we've found we need to be quite careful with that dependency.

@ddppi
Copy link
Author

ddppi commented Sep 8, 2020

ok, will create another virtual environment in conda and try that.

In my research, I also get to know that for token caching to work, I need to have the package "secure-local-storage" installed when I install snowflake-connector-python. However, I can't run pip install "snowflake-connector-python[secure-local-storage]" because my PC always failed due to "SSL: CERTIFICATE_VERIFY_FAILED". What I did is to clone the repo to my local disk, and install manually there by running python setup.py for both DBT and python connector. Any change you know how to install the optional package "secure-local-storage" when I install snowflake-connector-python manually? I think it is part of the v2.3.1 installation? https://github.com/snowflakedb/snowflake-connector-python/blob/f4fe2277b82d98f2122478d5df712c59420ea0bd/setup.py#L236

I also reduce the threads to 1 in profiles.yml, as I think it would only run 1 model at a time? However, it doesn't help either.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2020

Not sure I can be helpful around how to install that optional package manually on your machine. It looks like it's the same in v2.2.10, though.

@ddppi
Copy link
Author

ddppi commented Sep 2, 2021

Close the issue. After I got the optional package installed, the problem seemed gone.
pip install "snowflake-connector-python[secure-local-storage, pandas]"

@ddppi ddppi closed this as completed Sep 2, 2021
@acatarinavr
Copy link

I had the same issue. Did the same:
pip install "snowflake-connector-python[secure-local-storage, pandas]"

and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants