Title: False positive in "Could not find a Next.js instrumentation file" (when `pageExtensions` are used in Next) · Issue #15652 · getsentry/sentry-javascript · GitHub
Open Graph Title: False positive in "Could not find a Next.js instrumentation file" (when `pageExtensions` are used in Next) · Issue #15652 · getsentry/sentry-javascript
X Title: False positive in "Could not find a Next.js instrumentation file" (when `pageExtensions` are used in Next) · Issue #15652 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/15652
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive in \"Could not find a Next.js instrumentation file\" (when `pageExtensions` are used in Next)","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n9.5.0\n\n### Framework Version\n\nnext@15.2.2\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n```js\n\nSentry.init({\n dsn: process.env[\"SENTRY_DSN\"] ?? \"\",\n enabled: Boolean(process.env[\"SENTRY_DSN\"]),\n});\n```\n\n### Steps to Reproduce\n\n1. Create a Next.js app\n\n1. Open `next.config.ts` and configure [`pageExtensions`](https://nextjs.org/docs/pages/api-reference/config/next-config-js/pageExtensions) (e.g. `pageExtensions: [\"page.tsx\", \"handler.ts\"]`)\n\n1. Create `instrumentation.handler.ts` or `src/instrumentation.handler.ts` (if `.handler.` suffix is specified, the file is ignored by Next.js)\n\n1. Init and configure Sentry\n\n1. Run `pnpm dev --turbopack=false`\n\n### Expected Result\n\nNo warnings (because Turbopack is off)\n\n### Actual Result\n\nA false-positive warning:\n\n```\n[@sentry/nextjs] Could not find a Next.js instrumentation file. This indicates an incomplete configuration\nof the Sentry SDK. An instrumentation file is required for the Sentry SDK to be initialized on the server:\nhttps://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-initialization-config-files\n(you can suppress this warning by setting SENTRY_SUPPRESS_INSTRUMENTATION_FILE_WARNING=1\nas environment variable)\n```\n\n### Additional context\n\nThe bug originates from https://github.com/getsentry/sentry-javascript/pull/15488:\n\nhttps://github.com/getsentry/sentry-javascript/blob/48ed271b6dfd247f57e06c97eb5f99b5742a66d6/packages/nextjs/src/config/webpack.ts#L452-L499\n\n↑ 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.\n\nGood news is that page extensions are already resolved in this file:\n\nhttps://github.com/getsentry/sentry-javascript/blob/48ed271b6dfd247f57e06c97eb5f99b5742a66d6/packages/nextjs/src/config/webpack.ts#L113-L115","author":{"url":"https://github.com/kachkaev","@type":"Person","name":"kachkaev"},"datePublished":"2025-03-14T21:57:02Z","url":"https://github.com/getsentry/sentry-javascript/issues/15652"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5d14b281-6f9b-0c67-5451-9a0e5bdc1aea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6B4:1FDA42:57A4BC:7666F8:6B043F36 |
| html-safe-nonce | 5396c2402181a2a9752f47651ace24287f773ad6bac6e19912cf25c3bae42c04 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkI0OjFGREE0Mjo1N0E0QkM6NzY2NkY4OjZCMDQzRjM2IiwidmlzaXRvcl9pZCI6IjU2NzIzNTQ2MjUxOTg3Njc5MjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8905121c75b7a3df7b39080ceae56198fe3905e102fa16037cc83b48fda0e480 |
| hovercard-subject-tag | issue:2921363491 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/15652/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c806e431865bd4fb9fe66c8da87f85c57fae7e88827f32f96498f314bf009d9d/getsentry/sentry-javascript/issues/15652 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c806e431865bd4fb9fe66c8da87f85c57fae7e88827f32f96498f314bf009d9d/getsentry/sentry-javascript/issues/15652 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kachkaev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width