fix(nextjs): Resolve Next.js version relative to the SDK when cwd differs - #24462
Merged
Merged
Conversation
…fers Next.js version detection only resolved `next/package.json` from `process.cwd()`. When the process starts outside the Next.js project root (custom servers, monorepos), detection returned undefined and `withSentryConfig` fell back to the Next 14 config shape, silently dropping `serverExternalPackages` on Next 15+. Fall back to resolving from the SDK's own location, where `next` is reachable as a peer dependency. Fixes #24461 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit dec3e31. Configure here.
Contributor
size-limit report 📦
|
chargome
marked this pull request as ready for review
September 17, 2026 13:06
chargome
requested review from
mydea and
s1gr1d
and removed request for
a team
September 17, 2026 13:06
JPeer264
approved these changes
Sep 17, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
withSentryConfigdetected the Next.js version by resolvingnext/package.jsonfromprocess.cwd()only. When the process starts outside the Next.js project root (custom servers, monorepos started from the repo root, supervisors with their own cwd), detection returnsundefinedand the SDK silently falls back to the Next 14 config shape. On Next 15+ this meansserverExternalPackagesis never set, and Next warns about the unrecognizedexperimentalkeys.Resolution now still tries
process.cwd()first, so the project's ownnextwins in the normal case, and falls back to resolving from the SDK's own location.nextis a peer dependency, so it's reachable from there even under pnpm's isolated installs.Fixes #24461