-
Notifications
You must be signed in to change notification settings - Fork 155
Static generation fails for nextjs: chunks not loaded, Flight payload returns embedded 404 in raw <pre> text #874
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
Comments
Are you sure that is the correct |
This is RSC, the issue is very likely caching and also likely not related to OpenNext itself. |
So, this is the version that
This is the
And this is the
|
To be fair, i'd say it's unlikely that the issue is with OpenNext itself, but rather with SST in the cloudfront functions. |
I actually found the problem after some inspection of the cloud distributions. It seems that for the lambda function I've set up a policy some time ago that would cache the result indefinitely. |
Summary
I am encountering a rare client-side rendering issue in my Next.js app deployed via SST on AWS.
Occasionally, when returning to a tab left inactive for a long time (on the
/home
page), the app fails to render properly.Instead of rendering the React components, the client receives a raw
<pre>
block.This causes the app to break visually and behave unexpectedly.
This is what it looks like:

The app uses the Next.js App Router with nested layouts.
The folder structure includes:
app/[domain]/...
β tenant-specific subdomainsapp/main
β the main app; the root/
page is rewritten tomain/(presentation)/home/page.tsx
.Middleware rewrites requests to
/main
when no subdomain is present, and to/[domain]
when a subdomain exists.The error seems linked to this setup but only happens rarely.
The build and deployment are handled via SST on AWS.
Iβm not sure if this is related to caching, stale Flight data, or chunk loading β but the raw
<pre>
containing a 404 page in the payload is what I'm thinking about.this is the
notFound
message that I found in the<pre>
text:I currently donβt have a minimal reproduction repo because Iβm unsure how to reproduce it, I'm not sure what causes it exactly.
Instead, you can check the live page here.
Additional information
The text was updated successfully, but these errors were encountered: