Repository navigation
fix(solidstart): Deliver the release to the browser through the page - #26513
sentry-junior[bot] wants to merge 1 commit into
Conversation
size-limit report 📦Compared: 55b81fd (PR test merge using develop at ed94112) Against: 452f91e (develop) · base run #66586
|
Optional E2E testsAll optional checks were successful. 2 successful. See the run. |
The bundler plugin wrote the release into the startup chunks of the client build. As the release defaults to the git SHA, every commit changed their content hashes, and the renames spread to every chunk importing them. The server now adds `<meta name="sentry-release">` to each page (a Nitro plugin on SolidStart 1, a Nitro middleware on SolidStart 2), the client `init` reads it when no `release` is passed, and the client build no longer injects the release. Server builds still inject it. `release.inject: false` turns the meta tag off as well. Ref: #26485 Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
fdbab02 to
22d336a
Compare
isaacs
left a comment
There was a problem hiding this comment.
The design is good. It reaches SSR, SPA (prerendered index.html) and static output on both SolidStart majors through the server, with no inline script, so there is no CSP impact. It keeps server release injection unchanged.
This is ready to land.
My answers to the open decisions in the description:
- SolidStart 1 precompressed copies under
.output/public: I agree that this can stay. Browsers never request server chunks, so their hashes do not affect caching. - Two plugin instances, release finalize and deploy running twice:
newDeployis guarded by the module-level_deployedReleasesset inpackages/bundler-plugins/src/core/build-plugin-manager.ts, so the deploy record is created once across instances. Release create, finalize and set-commits run once per build, each with their own build plugin manager. Vinxi already ran three separate builds through one instance before this PR, and the Sentry API treats repeat create and finalize calls as no-ops, so the second instance adds API calls but no duplicate data. - Body rewriting (64 KiB buffer, encoded bodies skipped,
content-lengthdropped): this is fine.
Optional notes:
packages/solidstart/src/nitro/releaseMiddleware.tsonly rewrites aResponse. If a SolidStart 2 handler ever returns a string or a stream for an HTML page, the page gets no tag and the client gets no release, without a warning. The E2E tests show that the current SolidStart 2 returns aResponse. Adebuglog for HTML that was not rewritten would make a future change in that visible.- The SolidStart 1 plugin handles string and web
ReadableStreambodies, but not a Node.jsReadable. That also passes through untouched. The E2E app covers the default setup. - This is the fifth copy in the stack of the
sentry-releasemeta tag reader and ofescapeAttribute. The browser SDK reading the tag itself, which I suggested on #26508, would remove the client copies.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 22d336a. Configure here.

What
The server adds
<meta name="sentry-release">to each page, and the clientinitreads it when noreleaseis passed. The client build no longer injects the release; server builds still do. This covers SSR, SPA (prerenderedindex.html) and static output on SolidStart 1 (Nitro v2 plugin) and 2 (Nitro v3 middleware).release.inject: falseturns the meta tag off too, and an explicitSentry.init({ release })still wins.Why
The release (the git SHA by default) was written into the client startup chunks, so every commit changed their content hashes, and the renames spread to every chunk importing them. Returning visitors lost their cached chunks on every deploy. A meta tag needs no CSP nonce.
Open decisions:
.br/.gz) copies of server chunks with the release under.output/public/assets/and_server/assets/. Browsers never request them, so caching isn't affected. Clearing them would mean turning off injection for the vinxissrandserver-fnsrouters too.inject: false, server as before), scoped by vinxi router target or Vite environment. Worth checking that release finalize or deploy doesn't run twice.<head>, andcontent-lengthis dropped.Stacked on #26512.
Ref: #26485
via Isaac Schlueter.
--
View Session [Sentry]