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

Return nil when fetching the latest tag results in a JSON::ParserError #11552

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

amazimbe
Copy link
Contributor

What are you trying to accomplish?

Resolve the Sentry error below:

JSON::ParserError
unexpected token at ''

The error occurs when fetching the latest tag results in a JSON::ParserError. However, the method where the result of this call is being used says the result is nilable; therefore it should be safe to return nil when the error occurs

How will you know you've accomplished your goal?

The error will no longer appear in Sentry.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@amazimbe amazimbe requested a review from a team as a code owner February 11, 2025 18:04
@github-actions github-actions bot added the L: docker Docker containers label Feb 11, 2025
@amazimbe amazimbe self-assigned this Feb 11, 2025
@amazimbe amazimbe changed the title Return nil when fetching latest tag results in a JSON::ParserError Return nil when fetching the latest tag results in a JSON::ParserError Feb 11, 2025
@@ -294,6 +294,10 @@ def fetch_digest_of(tag)
rescue RestClient::ServerBrokeConnection,
RestClient::TooManyRequests
raise PrivateSourceBadResponse, registry_hostname
rescue JSON::ParserError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we know why this happens? For example, why is the tag empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know at this point but one of the reasons I added the log below is so that I can get the docker repo name and the tag as that would be handy in any further investigations.

@amazimbe amazimbe merged commit 6481a95 into main Feb 12, 2025
60 checks passed
@amazimbe amazimbe deleted the amazimbe/handle-docker-json-parser-error branch February 12, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: docker Docker containers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants