-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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(nextjs): Don't accidentally trigger static generation bailout #9749
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate but fine for the moment I think. It's more important we don't crash users than attaching this extra data IMO.
(side rant: This pattern of fullstack frameworks listening to object/property accesses is really problematic for us. Same thing happens in Sveltekit and Astro and we can't always work around it. I get it's probably necessary but it's a major problem for instrumentation)
I agree with your side rant. Maybe as a semi work around you could check if the route in question uses static generation 🤔 |
@ovflowd I tried that in #9729 but it looks like there is no reliable way to check that. The framework may at any point change and break this again. 😭 |
We are running into an issue where we are triggering static generation bailout because we are accessing dynamic objects (e.g. the Request object) in routes that were designed to be static.
h/t to @ovflowd for finding this.
This PR fixes this issue by simply not accessing anything that triggers static generation bailout. Unfortunately, this means we are not recording the URL for requests but we haven't yet found a way to reliably access the URL without triggering static generation bailout.
Maybe we can revisit recording the URL in the future.