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: 404 and 500 route matching #12182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

braden-w
Copy link

@braden-w braden-w commented Oct 10, 2024

Changes

Standardize 404 and 500 route matching via isRoute404 and isRoute500 functions.

Closes #11595

I'm unsure where are the best places to put the isRoute404 and isRoute500 functions, so I put them in packages/astro/src/core/util.ts for now with other util files

They could be moved!

They are used in packages/astro/src/i18n/index.ts and packages/astro/src/vite-plugin-astro-server/route.ts

Testing

No tests were added as no new behavior was added. Ran pnpm test on the astro package via pnpm --filter astro run test.

Docs

n/a, this is a fix in behavior that addresses #11595

Copy link

changeset-bot bot commented Oct 10, 2024

🦋 Changeset detected

Latest commit: 1313505

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 Oct 10, 2024
@ematipico
Copy link
Member

@braden-w can you look at the tests? They are failing

@braden-w
Copy link
Author

Hmm unsure how to proceed, the errors seem a bit cryptic and unrelated to my changes. Is there anyone who might be well-suited for some guidance on how to read these?

CleanShot 2024-10-25 at 11 14 23@2x

@ematipico
Copy link
Member

ematipico commented Oct 25, 2024

The issue is that you imported utils.js inside files that can't have node.js modules, and utils.js import node:fs.

I suggest moving those functions inside routing.ts

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.

Dynamic Routes that starts with 404 redirects to 404 page rather than loads properly
2 participants