-
Notifications
You must be signed in to change notification settings - Fork 67
Page chunk for catch-all page at root level is evaluated/rendered on the server #43
Comments
Hi @Yegair, Thank you for your kind words and for this detailed issue report! I think you are absolutely right — it's probably related to issue #41. @lindsaylevine is already in touch with the team that manages the Netlify redirects/rewrites feature, to see if they can dig into the issue. We will keep you and everyone else posted here! For now, it's best to use the "no-op redirect" you mentioned. Stay tuned and thanks again for the report & repo to reproduce the issue! 🔥 |
@FinnWoelm i'm curious: why wouldn't you add that |
Hi @mraerino, thanks for checking this out! Really appreciate your help! All redirects generated by In fact, the URL only gets shadowed/rewritten when the square brackets are URI encoded: Adding to that suspicion is the fact that this issue only occurs when a catch-all redirect is present, such as: Please correct me if I'm wrong, but doesn't the fact, that a redirect with We wanted to raise this issue (rather than locally fix it with /_next/* /_next/:splat 200), in case there is actually an issue with the shadowing logic. Because if so, it might affect others using SPA with catch-all redirects (.e.g., a React app with /* /index.html 200) and local files with square brackets in their names (admittedly, it's not super common to have these in your file names). Does that make sense? Am I mistaken in my understanding of how things should work? Happy to chat more at any time, if it would be helpful! |
thank you for pointing out that detail. seems to be something we'd want to fix in the future. i'll make sure to open an internal issue. would there be a way to publish that file without special characters for now? |
Hey @mraerino, that's awesome to hear!! 🙌 😊 We can't publish it without special characters (it's created that way by the framework and there are a lot of internal references to those files with square brackets), but I think we will do the Thank you again for looking into this :) |
Hi @FinnWoelm, I'm facing this issue when I have something like The temporary The redirects generated are
|
@afzalsayed96 looking into this, thanks for reporting! |
#77 re-addresses this :) |
Hello,
First of all thanks for the great work with next-on-netlify, highly appreciated!
What is wrong?
If have a custom app which makes use of SSR via
getInitialProps
.pages/_app.jsx
:Also I have a catch-all page which is used as the index page and as a fallback if there is no matching page for the current route (obviously).
pages/[[...any]].jsx
:When I access the catch-all page it is being rendered on the server correctly, but the client side rendering fails. It seems the server sends the rendered HTML instead of the JS source code when the frontend fetches the static JS chunk for this page.
When I look at the network tab, I can see that the browser tried to fetch the JS chunk, but received fully rendered HTML instead:
As far as I could test it, this seems not to happen for catch-all pages within subdirectories. For example
pages/foo/[[...any]].jsx
works as expected.How to reproduce?
I have set up a minimal repository which reproduces the issue: https://github.com/Yegair/next-on-netlify-minimal.
You can also have a look at the running example here: https://condescending-allen-4992da.netlify.app/
Are there related issues?
This issue may be related to #41 (at least the workaround is the same).
Is there a Workaround?
As I said above, the Workaround from #41 seems to resolve the issue.
Just add a "No-Op redirect" for the
/_next/*
route:_redirects
:The text was updated successfully, but these errors were encountered: