Area: Ingestion Issues
Sub-Area: Authentication and Token Management
Applies to: OSS + Cloud
Issue
An ingestion recipe fails when it connects to dbt Cloud or Snowflake, or when it sends results to DataHub. You may see one of these errors:
Failed to fetch environments from dbt Cloud API. Status code: <code>: <error>Failed to connect to snowflake instance: <error>HTTPSConnectionPool ... Max retries exceeded with url: /gms/aspects?action=ingestProposalBatch
You Might Be Asking
- Why did my dbt Cloud ingestion fail with a 401 error?
- Why does my Snowflake key-pair login fail with "JWT token is invalid"?
- Is the
/gms/aspects?action=ingestProposalBatcherror a dbt Cloud or Snowflake authentication problem? - Which keys does a dbt Cloud recipe use?
Cause
-
dbt Cloud: The dbt-cloud source raises
Failed to fetch environments from dbt Cloud API. Status code: <code>: <error>when its call to list environments fails. That call happens in auto-discovery mode, and in Test Connection when auto-discovery is on. It uses the recipe'stoken, so check that token first. A recipe that uses wrong key names fails validation before any API call, because DataHub recipes reject unknown keys. The keysdbt_cloud_urlanddbt_cloud_auth_tokendo not exist. Useaccess_urlandtokeninstead. -
Snowflake: With
authentication_type: KEY_PAIR_AUTHENTICATOR, the source uses the key pair when it opens the connection. A failure there appears asFailed to connect to snowflake instance: <error>. This is a login failure at connect time. If the error contains "not granted to this user", it appears asPermissions error when connecting to snowflake: <error>. -
/gms/aspects?action=ingestProposalBatch: This is the DataHub REST sink endpoint. The error means the ingestion process could not reach DataHub. It is not a dbt Cloud or Snowflake authentication problem.
Solution
dbt Cloud
- Create or check a dbt Cloud service account token. DataHub docs ask for the "Metadata Only" (read-only) permission. Account Admin is not needed.
- Take the account, project and job IDs from the job details page URL. For
https://cloud.getdbt.com/next/deploy/107298/projects/175705/jobs/148094, the account is 107298, the project is 175705 and the job is 148094. - Use these keys in the recipe. Replace
dbt_cloud_urlwithaccess_urlanddbt_cloud_auth_tokenwithtoken. Unknown keys fail validation.
source:
type: dbt-cloud
config:
access_url: "https://cloud.getdbt.com"
token: "${DBT_CLOUD_TOKEN}"
account_id: 107298
project_id: 175705
job_id: 148094
target_platform: snowflake
-
access_urldefaults tohttps://cloud.getdbt.com. Include the scheme and leave off the trailing slash. -
token,account_idandproject_idare required.account_idandproject_idare integers, so don't leave them empty. -
job_idis required unless you enableauto_discovery. Without either, you get: "job_id is required in explicit mode. Either provide job_id or enable auto_discovery mode." -
target_platformis required.
- Check that the secret you reference (here
DBT_CLOUD_TOKEN) exists and holds a valid token for thataccount_id. - Save the recipe and run ingestion again.
See dbt Cloud module for explicit mode and auto-discovery mode.
Snowflake key-pair login
If the error says "JWT token is invalid", Snowflake rejected the key-pair login. Check these:
- The public key set on the Snowflake user matches the private key in the recipe.
-
usernameis the right Snowflake user. -
account_idis the full account identifier, for examplexy12345.us-east-2.aws. -
private_keyorprivate_key_pathis set (at least one is required), andprivate_key_passwordis set if the key has a passphrase. -
roleandwarehouseare set as needed.
source:
type: snowflake
config:
account_id: "xy12345.us-east-2.aws"
username: "${SNOWFLAKE_USER}"
authentication_type: KEY_PAIR_AUTHENTICATOR
private_key: "${SNOWFLAKE_PRIVATE_KEY}"
private_key_password: "${SNOWFLAKE_PASSPHRASE}"
warehouse: "<warehouse>"
role: "<role>"
If you still use username and password (DEFAULT_AUTHENTICATOR), switch to KEY_PAIR_AUTHENTICATOR. Snowflake is deprecating password authentication, and the Snowflake source warns that it stops working on an account-specific date.
ingestProposalBatch connection error
- Check which DataHub the ingestion process sends to. If the recipe has no
sink, the pipeline uses a defaultdatahub-restsink. The CLI takes its connection from your environment or~/.datahubenv, for exampleDATAHUB_GMS_URLandDATAHUB_GMS_TOKEN. See CLI environment variables. - If DataHub rejects the token, the CLI prints
Unable to connect to <url> - got an authentication error: <response text>.Any other non-OK status printsUnable to connect to <url> with status_code: <code>.Fix the sink token or URL. - In DataHub Cloud, open Admin > Data Sources, open the source's run history and read the logs. If the source can't reach DataHub, contact DataHub Support.
See UI ingestion for run history and logs.