Repository navigation
feat(nextjs): Add deterministicPrerenders build option - #27010
Conversation
size-limit report 📦Compared: edd7f4c (PR test merge using develop at 7f296d8) Against: 7f296d8 (develop) · base run #68432 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsAll optional checks were successful. 7 successful. See the run. Successful checks
|
| /** | ||
| * Keeps the HTML of a prerendered page identical between regenerations whose content did not change, so that a | ||
| * platform which bills ISR writes by changed output, such as Vercel, does not bill for them. | ||
| * | ||
| * By default, a page that a sampled request prerenders carries the trace and the start time of that prerender. The | ||
| * pageload of a visitor links the trace and reports the age of the page as `page.server_rendering.age`. With this | ||
| * option, prerendered pages carry neither, so their pageloads have no such link and no age. They are still marked | ||
| * with `page.server_rendering.type`. | ||
| * | ||
| * @default false | ||
| */ |
There was a problem hiding this comment.
I think we should rather focus on what that means for the user in the end. That they would loose the "Open linked trace" functionality in the UI, pageload and server being two separate traces without the link.
There was a problem hiding this comment.
Good point, I reworded it.
| * | ||
| * @default false | ||
| */ | ||
| deterministicPrerenders?: boolean; |
There was a problem hiding this comment.
What about linkCachedPageRenders (default true) so it's more focused on what impact it has for the user?
I am not a fan of deterministic here as (seeing it as a whole) Sentry has no power over a page being deterministically rendered or not. Within what Sentry touches, yes. But not for the whole application.
There was a problem hiding this comment.
I'd like to keep the name. The option is for people who need stable ISR output, and that is what they will look for. If we later find other things Sentry writes that change per render, they belong under this flag too, and a name about the link would no longer fit. I added a line to the doc comment that this only covers what Sentry adds, not the whole page.
A sampled prerender still writes its trace and start time into the HTML, so its output differs on every ISR regeneration. With this option, no prerender writes them, at the cost of the `cache_origin` link and `page.server_rendering.age` on pageloads of prerendered pages. Closes #27002 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
f83fcfe to
f2bcffc
Compare
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…a tags (#27017) ## What SvelteKit and Nuxt pages rendered by an unsampled request now get an empty `sentry-cache-origin` tag and no `sentry-render-start` tag. Sampled renders and pages prerendered in the build are unchanged. ## Why Follow-up to #27009, which fixed this for Next.js only. SvelteKit and Nuxt write the tags through a shared helper in core with the same problem: an unsampled render changed the cached HTML on every regeneration, which Vercel bills as an ISR write. The tag stays, with empty content, so pageloads keep `page.server_rendering.type`. They lose `page.server_rendering.age` for unsampled renders. Stacked on #27010. Refs: #27002 Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…1054) ## DESCRIBE YOUR PR Documents the new `deterministicPrerenders` option of `withSentryConfig`, added in getsentry/sentry-javascript#27010. It keeps what Sentry writes into a prerendered page identical between regenerations, for platforms that only bill an ISR write when the output changed. ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD - [ ] Other deadline: YYYY-MM-DD - [x] No deadline: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
What
Adds a
deterministicPrerendersoption towithSentryConfig. With it, no prerender writes its trace or start time into the HTML, so the output of an ISR regeneration stays identical when the content did not change.Why
After #27009, a sampled prerender still changes the HTML on every regeneration, which Vercel bills as an ISR write. Users with large pages or a high sample rate need a way to turn that off. The option costs the
cache_originlink andpage.server_rendering.ageon pageloads of prerendered pages, so it is off by default. Pageloads keeppage.server_rendering.type.Stacked on #27009.
Closes: #27002