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

[CT-49] [Bug] dbt deps does not handle/retry on a malformed response from hub #4577

Closed
1 task done
barberscott opened this issue Jan 17, 2022 · 2 comments · Fixed by #4609
Closed
1 task done

[CT-49] [Bug] dbt deps does not handle/retry on a malformed response from hub #4577

barberscott opened this issue Jan 17, 2022 · 2 comments · Fixed by #4609
Assignees
Labels
bug Something isn't working deps dbt's package manager
Milestone

Comments

@barberscott
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If in the process of running dbt deps dbt receives a malformed response from hub.getdbt.com deps will fail:

Traceback (most recent call last):
  File "/usr/src/app/sinter/clients/dbt.py", line 1200, in call
    dbt_main.handle(command + extra_args)
  File "/usr/local/lib/python3.8/dist-packages/dbt/main.py", line 152, in handle
    res, success = handle_and_check(args)
  File "/usr/local/lib/python3.8/dist-packages/dbt/main.py", line 192, in handle_and_check
    task, res = run_from_args(parsed)
  File "/usr/local/lib/python3.8/dist-packages/dbt/main.py", line 246, in run_from_args
    results = task.run()
  File "/usr/local/lib/python3.8/dist-packages/dbt/task/deps.py", line 56, in run
    final_deps = resolve_packages(packages, self.config)
  File "/usr/local/lib/python3.8/dist-packages/dbt/deps/resolver.py", line 135, in resolve_packages
    target = final[package].resolved().fetch_metadata(config, renderer)
  File "/usr/local/lib/python3.8/dist-packages/dbt/deps/registry.py", line 121, in resolved
    self._check_in_index()
  File "/usr/local/lib/python3.8/dist-packages/dbt/deps/registry.py", line 92, in _check_in_index
    if self.package not in index:
TypeError: argument of type 'NoneType' is not iterable

while attempting to parse the JSON response which, presumably, is bad.

Expected Behavior

  • Log the bad JSON so that we know what hub sent
  • Retry similar to how retry happens for failures to connect and for empty responses

Steps To Reproduce

No response

Relevant log output

No response

Environment

No response

What database are you using dbt with?

No response

Additional Context

No response

@barberscott barberscott added bug Something isn't working triage labels Jan 17, 2022
@github-actions github-actions bot changed the title [Bug] dbt deps does not handle/retry on a malformed response from hub [CT-49] [Bug] dbt deps does not handle/retry on a malformed response from hub Jan 17, 2022
@jtcohen6 jtcohen6 added Team:Language packages Functionality for interacting with installed packages labels Jan 17, 2022
@jtcohen6 jtcohen6 added this to the v1.0.2 milestone Jan 20, 2022
@emmyoop
Copy link
Member

emmyoop commented Jan 21, 2022

@barberscott thanks again for the detailed issue! This is a result of a big of a bug associated with our retry logic.

We should be checking here if resp.json() is None not just the resp object.

if resp is None:
raise requests.exceptions.ContentDecodingError(
'Request error: The response is None', response=resp
)

If it is None we should retry.

This issue is part of our next release (1.0.2) and I'm actively working on it! Similar to #4579 I'm going to need to think a bit more on what, if anything, should be logged in this case. Possibly the entire response? Once I fix the logic to fall into the ContentDecodingError, we will be logging the entire response!

@leahwicz
Copy link
Contributor

leahwicz commented Feb 1, 2022

Backport here: #4649

@jtcohen6 jtcohen6 added deps dbt's package manager and removed packages Functionality for interacting with installed packages labels Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deps dbt's package manager
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants