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: set status on error with progressive fallback #11054

Merged
merged 4 commits into from
May 20, 2024

Conversation

bholmesdev
Copy link
Contributor

@bholmesdev bholmesdev commented May 15, 2024

Changes

Respect error status when using a progressive fallback. This will overwrite any status set from Astro frontmatter with response.status. Curious if we think this makes sense?

Testing

Already have e2e test for progressive fallback validation errors. It doesn't check the status, but this is difficult to assert.

Docs

N/A

Copy link

changeset-bot bot commented May 15, 2024

🦋 Changeset detected

Latest commit: 7fa8656

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 15, 2024
@ematipico
Copy link
Member

Tests are failing consistently 🤔

Comment on lines 52 to 56
return new Response(response.body, {
status: result.error.status,
statusText: result.error.message,
headers: response.headers,
})
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should return a simplified statusText for prod? In #10284, it was considered a vulnerability that the error message was shown to the users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I also realized statusText does not support special characters like newlines. To keep things simple, I'll just out the error.name here, which is just the status code written out like NOT_FOUND. No need for prod security checks I don't think

@bholmesdev bholmesdev force-pushed the fix/set-status-on-progressive-fallback branch from b6442fd to 770c771 Compare May 17, 2024 20:52
@bholmesdev bholmesdev merged commit f6b171e into main May 20, 2024
13 checks passed
@bholmesdev bholmesdev deleted the fix/set-status-on-progressive-fallback branch May 20, 2024 19:57
@astrobot-houston astrobot-houston mentioned this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants