-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills' #8180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Assigning to @getsentry/support for routing, due by Monday, May 22nd at 5:00 pm (sfo). ⏲️ |
Hey, can you share a small reproduction app where this is happening thank you! |
This also happened to me in an application using Yarn Berry (v3.5.1) and PnP on NextJS. I also tried unplugging |
Hello. |
@Huespal so far nobody provided a reproduction example, which we would need in order to fix this bug. |
Reproduction app |
Ok since this is working for all other package managers do you mind opening an upstream issue in yarn berry for this? Thanks. |
Okay. I'll create an upstream issue. |
@mydea @lforst This is not a bug in Yarn. Yarn requires packages to strictly declare their dependencies and will raise an error if a package attempts to import something it hasn't declared. I believe(*) in this case the reason it fails is because the Sentry NextJS plugin adds some extra code in the various files in The quickest fix for this is just to explicitly add (* I'm making some educated guesses here, but I'm not familiar with how the Sentry integration actually hooks into NextJS so it might be off base) |
@sebpowell Yes please. We have yet to receive proper repro on this. |
@mayank1513 Thanks can you provide instructions on how to reproduce. Thanks! |
clone the branch or create codespace then
|
@mayank1513 your repro is failing due to issues unrelated to sentry:
|
Attempting to add Sentry to my Next.js project (using App Router and
Update: pnpm install @sentry/utils |
I was running into this similar problem, and it turns out in my Webpack configuration (technically the config function that I send through my 11ty Webpack plugin config) I had at one time added I determined that removing that entry in part caused this issue to occur. Adding the Here's an abridged section of my plugin's Webpack config object: // ...
module: {
rules: [
// I'm extending a default configuration
...defaultWebpackConfig.module.rules,
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules|\.d\.ts$/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
}
// ... For reference, here's my tsconfig: {
"include": ["./src/js/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
"target": "ES2015",
"moduleResolution": "node",
"allowJs": true,
"module": "ES6",
"lib": ["es2022", "dom", "dom.iterable"],
"sourceMap": true,
"inlineSources": true,
// Set `sourceRoot` to "/" to strip the build path prefix
// from generated source code references.
// This improves issue grouping in Sentry.
"sourceRoot": "/"
}
} |
As a positive outlook: We aim to fix this reliably with the new major of the SDK! Sorry for the trouble this has caused. We have a bit of tech debt here. |
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
"next": "^13.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
use app dir
Expected Result
It works without any problems.
Actual Result
./app/posts/[slug]/page.tsx
Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills'
https://nextjs.org/docs/messages/module-not-found
Product Area
Unknown
Link
No response
DSN
No response
Version
7.52.1
The text was updated successfully, but these errors were encountered: