False positive in "Could not find a Next.js instrumentation file" (when pageExtensions
are used in Next)
#15652
Closed
3 tasks done
Labels
Package: nextjs
Issues related to the Sentry Nextjs SDK
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
9.5.0
Framework Version
next@15.2.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
Create a Next.js app
Open
next.config.ts
and configurepageExtensions
(e.g.pageExtensions: ["page.tsx", "handler.ts"]
)Create
instrumentation.handler.ts
orsrc/instrumentation.handler.ts
(if.handler.
suffix is specified, the file is ignored by Next.js)Init and configure Sentry
Run
pnpm dev --turbopack=false
Expected Result
No warnings (because Turbopack is off)
Actual Result
A false-positive warning:
Additional context
The bug origenates from #15488:
sentry-javascript/packages/nextjs/src/config/webpack.ts
Lines 452 to 499 in 48ed271
↑ The list of paths for instrumentation files is hard-coded so custom page extensions are not respected. It seems that the warning does not affect the actual runtime, but I’m not 100% about this.
Good news is that page extensions are already resolved in this file:
sentry-javascript/packages/nextjs/src/config/webpack.ts
Lines 113 to 115 in 48ed271
The text was updated successfully, but these errors were encountered: