Repository navigation
Labels
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/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
8.1.0
Framework Version
next 14.2.3
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: "change me",
tracesSampleRate: 1,
debug: false,
integrations: [
Sentry.feedbackIntegration({
autoInject: false,
}),
],
});
Steps to Reproduce
Upgrade @sentry/nextjs from v7.113.0 to v8.1.0 and run the project build process
Expected Result
The build process should complete without warnings related to critical dependencies.
Actual Result
After upgrading to @sentry/nextjs version 8, I encountered the following warning in the build logs:
⚠ ./node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
./node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/index.js
./node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/platform/index.js
./node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/index.js
./node_modules/@prisma/instrumentation/dist/chunk-64MZJIQ5.js
./node_modules/@prisma/instrumentation/dist/index.js
./node_modules/@sentry/node/cjs/integrations/tracing/prisma.js
./node_modules/@sentry/node/cjs/index.js
./node_modules/@sentry/nextjs/cjs/index.server.js
./app/global-error.tsx
Reacted by Thomas Kunwar, Qing, Taylor Halliday, hpohl-pley, Paca, Carl Baatz and Andrzej Kłapeć
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
mydea commentedon May 16, 2024
Hmm, let's see if this: #12081 possibly fixes this 🤔
gusfune commentedon May 17, 2024
I can also confirm this is going on
8.2.1version.MarwanAlsoltany commentedon May 17, 2024
+1
lforst commentedon May 21, 2024
This warning can be safely ignored. In theory, the SDK should add an ignore rule for this warning. I wonder why that doesn't work for you 🤔
sentry-javascript/packages/nextjs/src/config/webpack.ts
Lines 662 to 669 in 7e59832
Would you mind sharing your next.config.js? Can you try adding the following to your
ignoreWarningsin your Next.js webpack config?35 remaining items
lforst commentedon Oct 2, 2024
@mattsacks Ok so you're lacking like a really critical piece of the SDK setup which is wrapping your
nextConfiginnext.config.mjsinwithSentryConfig().It is outlined here: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#extend-your-nextjs-configuration
lforst commentedon Oct 3, 2024
I am gonna carefully close this again because I think we're good. (?) Lmk if this is still an issue with the intended setup.
mattsacks commentedon Oct 3, 2024
@lforst that fixes the error in my repro case. Thanks!
tom2strobl commentedon Oct 11, 2024
FYI: I still experience the warning on
node 20.17.0 with esm-style
type: "module"@sentry/electron: 5.6.0
@sentry/node: ^8.34.0
webpack: 5.75.0
(not on @sentry/nextjs)
From what I've experienced it doesn't really matter how or where I import Sentry and also both @sentry/electron and @sentry/node are affected.
I mean I just added the
to my webpack config to hide it and that works. If you say it doesn't matter, I'm fine with it.
Just wanted to report my findings.
lforst commentedon Oct 14, 2024
@tom2strobl This issue is about Next.js. For Next.js we simply ignore the warning OOTB because it actually has no effect whatsoever on the application.
For all other use-cases (like yours), people need to decide themselves whether they wanna ignore the warning or not. It may be the case that it breaks your build in some way, but since you are a bit more free-form, we cannot know that.
We never "fixed" this issue, we simply ignored it because we deemed it non-harmful and it caused confusion.
In your case ignoring it like you did is probably fine :) Actually, I think ignoring the warning is fine for 99.99999% of the cases.
ludwighogstrom commentedon Nov 15, 2024
Also getting this error with
next 15.0.3and@sentry/nextjs 8.37.1when runningnext dev.The error disappears when I add this to the
next.configI don't know if this has any drawbacks??
If you look at the documentation for
serverExternalPackages, you'll see thatNext.jsadds a lot of popular packages by its own. Maybe@sentry/nextjsshould be on that list too?lforst commentedon Nov 15, 2024
@ludwighogstrom
Do not do this. It will break a lot of things.
Please provide a reproduction in a new issue. thanks!
lforst commentedon Nov 15, 2024
Locking this issue because it promotes "+1s" without reproduction. If you encounter this problem please open a new issue with reproduction including code that we can run.