Comments (12)
I updated to @sentry/nextjs 8.9.2 and still getting this warning log
from sentry-javascript.
I can also confirm this is going on 8.2.1
version.
from sentry-javascript.
I can also confirm this is going on
8.2.1
version.
+1
from sentry-javascript.
Hmm, let's see if this: #12081 possibly fixes this 🤔
from sentry-javascript.
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 ignoreWarnings
in your Next.js webpack config?
[
{ module: /@opentelemetry\/instrumentation/, message: /Critical dependency/ },
{ module: /@prisma\/instrumentation/, message: /Critical dependency/ },
]
from sentry-javascript.
Hi there. I'm using @sentry/nextjs v8.7.0
and I still get the warning in the console:
- warn ../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/platform/node/instrumentation.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/platform/node/instrumentation.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/platform/node/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/platform/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetr_easlgnajsmadvvyfptwg27pvmy/node_modules/@sentry/opentelemetry/cjs/index.js
../../node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/cjs/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_n5hycvwuc2wadypxzgqutrwu2y/node_modules/@sentry/nextjs/cjs/index.server.js
Is the issue closed because the fix is going to be released in a new version? 🤔
from sentry-javascript.
@GiancarlosIO It's not really a fix we published but we are ignoring the warning automatically. The code for this is here:
I struggle a bit to understand how this is happening. Would you mind sharing reproduction? Thanks!
from sentry-javascript.
@cyrus-za would you mind sharing more information? The import trace would be helpful.
from sentry-javascript.
@cyrus-za would you mind sharing more information? The import trace would be helpful.
I setup my nextjs project with the instrumentation hook defined here
Using next 14.2.3
, nx 19.2.2
, pnpm 9.1.0
and node 20.14.0
I got a nx lib for my wrapper around sentry. Not sure if that makes a difference.
Everything worked just fine before the switch to v8
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/esm/platform/node/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/esm/platform/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/esm/index.js
../../node_modules/.pnpm/@[email protected]/node_modules/@prisma/instrumentation/dist/chunk-B5GLSQ4E.js
../../node_modules/.pnpm/@[email protected]/node_modules/@prisma/instrumentation/dist/index.js
../../node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/cjs/integrations/tracing/prisma.js
../../node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/cjs/index.js
../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_ujmyanxtchbaumo3rdotqhac5q/node_modules/@sentry/nextjs/cjs/index.server.js
../utils/sentry/src/lib/sentry.ts
../utils/sentry/src/index.ts
./src/app/layout.tsx
from sentry-javascript.
It might be nx that is messing with our ignoring of the warning.
@GiancarlosIO are you also using nx?
Please note: It is safe to ignore this warning. All it does, is say that webpack is unable to statically analyze an import. This may have some implications with regards to bundling server code but in 99.999% of the cases this should be fine.
from sentry-javascript.
In case it helps, here's my nextjs config
/* eslint-disable n/no-process-env */
import { composePlugins, withNx } from '@nx/next'
import { withSentryConfig } from '@sentry/nextjs'
import webpack from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
/** @type {import('@nx/next/plugins/with-nx').WithNxOptions} */
const config = {
experimental: {
instrumentationHook: true,
},
typescript: {
tsconfigPath: 'tsconfig.app.json',
// `build` depends on `type-check` so we don't need to run `type-check` separately
ignoreBuildErrors: true,
},
nx: {
// Set this to true if you would like to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
},
webpack(cfg, { isServer, nextRuntime }) {
// eslint-disable-next-line no-param-reassign
cfg.resolve.alias.canvas = false
if (isServer && nextRuntime === 'nodejs') {
cfg.plugins.push(new webpack.IgnorePlugin({ resourceRegExp: /@aws-sdk\/signature-v4-crt/ }))
}
return cfg
},
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'lh3.googleusercontent.com',
port: '',
pathname: '/**/*',
},
{
protocol: 'https',
hostname: 's.gravatar.com',
port: '',
pathname: '/**/*',
},
],
},
transpilePackages: ['jotai-devtools', 'react-pdf'],
}
const sentryConfig = {
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: false,
// Hides source maps from generated client bundles
hideSourceMaps: true,
automaticVercelMonitors: true,
// Suppresses source map uploading logs during build
silent: true,
}
const plugins = [
// Add more Next.js plugins to this list if needed.
withNx,
]
/** @type {import('@nx/next/plugins/with-nx').WithNxOptions} */
const configWithSentry = process.env.VERCEL ? withSentryConfig(config, sentryConfig) : config
export default composePlugins(...plugins)(configWithSentry)
from sentry-javascript.
I've managed to get this working by effectively duplicating the Sentry code for this myself in my Next config:
/** @type {import('next').NextConfig} */
const nextConfig = withSentryConfig(
...
webpack(
/** @type {import('webpack').WebpackOptionsNormalized} */ config,
/** @type {import('next/dist/server/config-shared').WebpackConfigContext} */ context
) {
config.ignoreWarnings = [
...(config.ignoreWarnings ?? []),
(warning, { requestShortener }) => {
const isOtelModule =
!!warning.module &&
(/@opentelemetry\/instrumentation/.test(warning.module.readableIdentifier(requestShortener)) ||
/@prisma\/instrumentation/.test(warning.module.readableIdentifier(requestShortener)))
const isCriticalDependencyMessage = /Critical dependency/.test(warning.message)
return isOtelModule && isCriticalDependencyMessage
},
]
},
...
)
I'm not sure if the reason the Sentry code only catches one of the two errors is because it's only looking at the server context?
from sentry-javascript.
Related Issues (20)
- Add solidstart to release registry
- Add release registry target entry for solidstart to craft.yml
- Add solidstart SDK docs
- Add solidstart onboarding
- A drop in simultaneous requests per seconds with Bun when Sentry is active HOT 3
- Align `Span` interface with changes in Otel Span interface
- Could not find a declaration file for module `@sentry/profiling-node` HOT 5
- Sentry SDK sends events of type `session` twice to two different DSNs
- Add Nuxt SDK package boilerplate
- Inconsisten span origin naming
- SpyOn captureException no longer works in sentry/react 8 HOT 2
- V8 Integrations are broken HOT 9
- Code sign the Sentry lambda layer to use in code signed lambdas HOT 1
- Module not found: Can't resolve 'opentelemetry-instrumentation-fetch-node' HOT 3
- Local variables missing when exception originates in node_modules dependency HOT 4
- Renable http instrumentation test for node-express-esm-preload
- JavaScript heap out of memory HOT 6
- Feedback Modal: Missing Screenshot btn in production HOT 3
- Sentry.captureFeedback produces unviewable images in sentry.io
- Problems with `@sentry/astro` on Netlify HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-javascript.