When specifying the dbt-cloud-host (e.g. emea.dbt.com) in the cli-arguments when starting a job, the job is started with the correct url.
BUT the loop for checking the run-state does not use the overridden host, but the default host cloud.getdbt.com, causing the check to fail with:
Traceback (most recent call last):
File "/home/aretz/git/dbt_bi-vertrieb/.venv/bin/dbt-cloud", line 8, in <module>
sys.exit(dbt_cloud())
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/aretz/git/dbt_bi-vertrieb/.venv/lib/python3.9/site-packages/dbt_cloud/cli.py", line 117, in run
status = DbtCloudRunStatus(response.json()["data"]["status"])
TypeError: 'NoneType' object is not subscriptable
By drilling through the code, I found out, that the root problem was a <Response [401]>, while getting the run-state, because the API of cloud.getdbt.com is accessed where the used token is not valid.
When specifying the dbt-cloud-host (e.g.
emea.dbt.com
) in the cli-arguments when starting a job, the job is started with the correct url. BUT the loop for checking the run-state does not use the overridden host, but the default hostcloud.getdbt.com
, causing the check to fail with:By drilling through the code, I found out, that the root problem was a
<Response [401]>
, while getting the run-state, because the API ofcloud.getdbt.com
is accessed where the used token is not valid.Changing the cli.py (lines 109 - 114) from:
to
solves the problem. I'm double hefthanded and a python-novice and therefore not quite sure if it is the right place to fix this issue.