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

Fix SQS error handling. #14717

Merged
merged 7 commits into from
Oct 8, 2024
Merged

Fix SQS error handling. #14717

merged 7 commits into from
Oct 8, 2024

Conversation

samwho
Copy link
Collaborator

@samwho samwho commented Oct 7, 2024

Description

We were attempting to parse the body as JSON before we knew it was JSON, resulting in parse failures before the error handling could kick in.

@samwho samwho requested a review from adrinr October 7, 2024 08:49
@samwho samwho requested a review from a team as a code owner October 7, 2024 08:49
@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/s labels Oct 7, 2024
if (response.status > 300) {
throw json
if (response.status >= 300) {
const text = await response.text()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this always be text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct me if I'm wrong but I thought .text() just got the plain old body contents without trying to parse it, so I thought it was always safe to use.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, you are right!

@samwho samwho enabled auto-merge October 8, 2024 08:59
@samwho samwho merged commit be4bc43 into master Oct 8, 2024
12 checks passed
@samwho samwho deleted the graceful-sqs-5xx-error-handling branch October 8, 2024 09:08
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants