Repository navigation
feat(nextjs): Add applicationKeyExcludeDependencies option
#25818
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
Merged
msonnb
merged 3 commits into
develop
from
ms/turbopack-application-key-exclude-dependencies
Oct 30, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-16/fixtures/metadata-dependency/index.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export function createDependencyError(): Error; | ||
| export function createAsyncDependencyError(): Promise<Error>; |
10 changes: 10 additions & 0 deletions
10
dev-packages/e2e-tests/test-applications/nextjs-16/fixtures/metadata-dependency/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export function createDependencyError() { | ||
| return new Error('application-key-dependency-error'); | ||
| } | ||
|
|
||
| export function createAsyncDependencyError() { | ||
| return new Promise(resolve => { | ||
| // Wait until the application's call stack has unwound so the error stack contains only a dependency frame. | ||
| queueMicrotask(() => resolve(new Error('application-key-dependency-only-error'))); | ||
| }); | ||
| } |
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/nextjs-16/fixtures/metadata-dependency/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "name": "sentry-metadata-test-dependency", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "main": "index.js" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,6 +225,21 @@ export type SentryBuildOptions = Omit< | |
| */ | ||
| applicationKey?: string; | ||
|
|
||
| /** | ||
| * Skip application key metadata injection for dependencies in Turbopack builds with Next.js 16+. | ||
| * Uses Turbopack's `foreign` condition, which includes `node_modules` and some Next.js internals. | ||
| * Requires `applicationKey`. Has no effect on webpack builds. | ||
| * | ||
| * This reduces per-module injection overhead, but chunks containing only dependencies may no | ||
| * longer be tagged as first-party. Only use with `*-exclusively-contains-third-party-frames` | ||
| * behaviours of `thirdPartyErrorFilterIntegration`, and accept that errors whose stacks are | ||
| * entirely in untagged chunks can be dropped or tagged as third-party. With `*-contains-*` | ||
| * behaviours, even one frame from an untagged chunk can cause this misclassification. | ||
| * | ||
| * @default false | ||
| */ | ||
| applicationKeyExcludeDependencies?: boolean; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could print a build time warning if this option is used in webpack or without |
||
|
|
||
| /** | ||
| * Metadata that should be associated with the built application. | ||
| * | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just noting that this is just a regression test because the stack will always contain the
onClickframe. Maybe would be worth adding a second test to check the case with library frames only.