Skip to content

release.inject gives startup chunks new file names on every commit #26485

Open

Description

@AI091

Problem Statement

release.inject defaults to true, and release.name defaults to the current commit. So every chunk that gets the release snippet gets a new content hash on every commit, even when its code did not change.

Since #25541 this only hits startup chunks, but those are exactly the files every returning visitor needs first. Other chunks import them by their hashed file names, so the renames spread from there.

On @sentry/nuxt 10.47, a deploy that changed one image renamed 140 of 147 client files. release: { inject: false } fixed it.

This is a very weird default. A bundler plugin should not break the bundler's content hashing unless you ask it to, and most users will never notice that every deploy throws away their users' cache.

Solution Brainstorm

  • Keep the release out of content-hashed files: inject it into the HTML (transformIndexHtml in Vite, the HTML plugin in webpack) or into one small unhashed file.
  • Or default release.inject to false when the SDK already gets the release some other way (Sentry.init({ release }), framework runtime config).
  • Either way, document the caching cost on release.inject.

Debug IDs are not the problem: they come from the file content, so they don't change the hashes.

Additional Context

Same problem in the old repo: getsentry/sentry-javascript-bundler-plugins#680 (closed, but people still hit it there).

Workaround: release: { inject: false }, and pass release to Sentry.init at runtime.

Activity

  1. linear-code commented on Nov 17, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 17, 2026
  3. isaacs commented on Nov 17, 2026

    @isaacs
    Member

    Thank you for the detailed report and the numbers. You are right: a bundler plugin should not throw away your users' cache by default, and our docs do not tell you about this cost.

    Could you try again on a current version? You measured on @sentry/nuxt 10.47. Since #25541 (in 11.9.0, and backported to v10 in 10.77.1), we inject the release only into chunks that load at startup, not into every chunk. The startup chunks still get new hashes, and the renames still spread to the chunks that import them, so the problem is not gone. But the number of renamed files will probably be lower than 140 of 147, and the real number will help us decide how to fix it.

    Here is a plan:

    1. Document the cost now. We will add a note on release.inject (in the JSDoc and in the Sentry docs) that it changes content hashes on every release, with the workaround: release: { inject: false }, and pass release to Sentry.init at runtime.
    2. Fix it in the framework SDKs. Framework SDKs like @sentry/nuxt own the Sentry.init call, so they can pass the release through runtime config or a script in the page head, and turn off the build-time injection. Today the Nuxt module gives the release only to the bundler plugin, so we will start with Nuxt.
    3. Inject into the HTML for plain Vite and webpack apps. For single-page apps with an index.html, we can put the release in the HTML (transformIndexHtml in Vite, the HTML plugin in webpack) instead of in a hashed file. We will add this as an option first, and make it the default in the next major version.

    About the other ideas in the report:

    • One small unhashed file: this works only if the HTML loads that file directly. If a chunk imports it, the hash of that chunk changes anyway. An unhashed file can also come from a stale cache, and a wrong release is worse than no release, because events then go to the wrong release.
    • Default inject to false when the SDK already has the release: the bundler plugin cannot see what you pass to Sentry.init at runtime. If we changed the default for everyone, users who rely on injection would lose release data with no warning, so a change like that has to wait for a major version. The framework SDKs can make this choice, which is why step 2 is there.

    Thanks again for raising this. Let us know what you see on the newer version.

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions