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

[ADAP-881] Dbt Version 1.6.1 Not Able to Authenticate with Snowflake via Private Key Config #767

Closed
2 tasks done
chris-leigh-dignifi opened this issue Sep 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@chris-leigh-dignifi
Copy link

chris-leigh-dignifi commented Sep 11, 2023

Is this a new bug in dbt-snowflake?

  • I believe this is a new bug in dbt-snowflake
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I am able to successfully authenticate via the private_key_path, but when supplying the exact same key via a string using the private_key config in profiles.yaml, dbt is not able to authenticate with Snowflake. I am using an encrypted private key and currently running dbt version 1.6.1.

Expected Behavior

I expect dbt to be able to authenticate with Snowflake via either configuration options.

Steps To Reproduce

  1. Create new user in Snowflake with encrypted Private Key auth via Snowflake's instructions
  2. Test access via SnowSQL (optional)
  3. Supply auth parameters in dbt projects profiles.yaml file
    Test 1
  4. First try authenticating with the private_key_path config, confirm this method works
  5. Then try authenticating with the private_key config, confirm that this method does not work

Relevant log output

�[0m10:50:59.238622 [error] [MainThread]: Encountered an error:
Runtime Error
  Database error while listing schemas in database "dev__lake"
  Database Error
    ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [<OpenSSLError(code=109052072, lib=13, reason=168, reason_text=wrong tag)>, <OpenSSLError(code=109576458, lib=13, reason=524554, reason_text=nested asn1 error)>])
�[0m10:50:59.239026 [debug] [MainThread]: Command `dbt run` failed at 10:50:59.238975 after 1.99 seconds
�[0m10:50:59.239292 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x10596f460>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x113575e80>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x1135f8250>]}

Environment

- OS: MacOS Ventura Version 13.4.1
- Python: Python 3.9.18
- dbt-core: 1.6.1
- dbt-snowflake: 1.6.1

Additional Context

No response

@chris-leigh-dignifi chris-leigh-dignifi added bug Something isn't working triage labels Sep 11, 2023
@github-actions github-actions bot changed the title Dbt Version 1.6.1 Not Able to Authenticate with Snowflake via Private Key Config [ADAP-881] Dbt Version 1.6.1 Not Able to Authenticate with Snowflake via Private Key Config Sep 11, 2023
@dbeatty10 dbeatty10 self-assigned this Sep 11, 2023
@dbeatty10
Copy link
Contributor

Thanks for reaching out @chris-leigh-dignifi !

If you use a Base64-encoded DER private_key string, it should work as described here.

#671 added the ability to use the PEM format with a private_key string, but won't be available until dbt 1.7 (which will be released next month in October).

Based on the Snowflake's instructions you linked to, it sounds like you are trying to use the PEM format?

If so, then you'll have to use private_key_path until dbt 1.7.0 gives the ability to use private_key with the PEM format.

@dbeatty10 dbeatty10 removed their assignment Sep 11, 2023
@chris-leigh-dignifi
Copy link
Author

@dbeatty10 thank you for the quick response!

Yes that's correct -- I am using PEM format for my key generation. Do you happen to have any instructions on converting the private key to Base64-encoded DER format via the command line? I tried following these instructions, but did not have any luck.

@dbeatty10 dbeatty10 self-assigned this Sep 11, 2023
@dbeatty10
Copy link
Contributor

Sure thing @chris-leigh-dignifi !

Unfortunately, I don't happen to have a set of instructions to do that conversion, and I haven't done that before personally.

In the meantime, I'm going to close this in favor of #671 which should be released and available by the end of October.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
@dbeatty10 dbeatty10 removed their assignment Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants