withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.87k stars 2.49k forks source link

Catch all page ([...slug].astro) catch all Server island requests #11793

Closed dylanalizon closed 4 weeks ago

dylanalizon commented 3 months ago

Astro Info

Astro                    v4.14.3
Node                     v18.20.3
System                   Linux (x64)
Package Manager          unknown
Output                   server
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

All requests from the server islands (/_server-islands/*) are caught by the catchall page ([...slug].astro). This works locally but when you run npm run build and npm run preview or deploy (tested on Vercel) server island requests are caught by the route.

What's the expected result?

All server island requests (/_server-islands/*) must not be caught by the [...slug].astro page.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-wmamgi?file=astro.config.mjs

Participation

florian-lefebvre commented 3 months ago

@Fryuni do you think it's fixed by the global route priority flag?

dylanalizon commented 3 months ago

@Fryuni do you think it's fixed by the global route priority flag?

I've just tested it, but it doesn't fix the problem.

Fryuni commented 3 months ago

I think the server islands route is being appended after the routes get sorted

pablopunk commented 1 month ago

Not only catch-all routes but also 2-level routes like /[team]/[user].astro since that will match /_server-islands/ComponentName

tedevra commented 1 month ago

in the final build that is being deployed, there is no route file for _server-islands...

i think that this is the reasong behind this problem, the file is missing, so requests to urls that start with "/_server-island" will be caught by the custom catch all routes of the project. Could have something to do with the adapter that performs the build transformations for the specific environment (cloudflare, vercel, ...)?

For example: Astro adds a route file for Actions, if you are using that feature: image but no "/pages/server-islands/---path_.astro.mjs"