question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Sentry/Next.js] Not working with Webpack 5 on Next.js 11

See original GitHub issue

When trying to start my app with next 11, where webpack 5 is enabled by default I get the following error:

[Sentry] Could not initialize SDK. Received error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

Packages: “@sentry/nextjs”: “^6.7.1”, “next”: “^11.0.0”,

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mikestopcontinuescommented, Jun 19, 2021

I mistakenly posted on #3700 about a closely related issue. I’m receiving this error after updating to Next 11:

[Sentry] Could not initialize SDK. Received error:
Error: Cannot find module '/Users/Code/hub/.next/server/sentry/initServerSDK.js'
Require stack:
- /Users/Code/hub/node_modules/@sentry/nextjs/dist/utils/instrumentServer.js
- /Users/Code/hub/node_modules/@sentry/nextjs/dist/index.server.js
- /Users/Code/hub/next.config.js
- /Users/Code/hub/node_modules/next/dist/next-server/server/config.js
- /Users/Code/hub/node_modules/next/dist/server/next.js
- /Users/Code/hub/node_modules/next/dist/server/lib/start-server.js
- /Users/Code/hub/node_modules/next/dist/cli/next-dev.js
- /Users/Code/hub/node_modules/next/dist/bin/next

@joneath’s solution would not work in my case, as even after deleting the cache and hard-upgrading everything, .next/server/sentry/initServerSDK.js is NOT generated. In fact, no sentry file is generated anywhere I can find.

1reaction
tm1000commented, Jun 23, 2021

@mikestopcontinues I should have deleted that. I realized in https://github.com/getsentry/sentry-javascript/issues/3722 that I was not following the directions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not run server after add sentry to nextjs project
My nextjs config is empty and i do not think this is the problem of next. If i remove the sentry config, i...
Read more >
Manual Setup for Next.js - Sentry Documentation
This file sets a custom webpack configuration to use your Next.js app // with Sentry. // https://nextjs.org/docs/api-reference/next.config.js/introduction ...
Read more >
module-not-found - Next.js
The module you're trying to import is not installed in your dependencies; The module you're trying to import ... For example when importing...
Read more >
Next.js + Webpack - Fix for ModuleNotFoundError: Module not ...
To fix the error with Webpack 5, update your Next.js config file ( /next.config.js ) with the following, it tells webpack not to...
Read more >
How to Build, Deploy, & Monitor Next.js Applications with ...
Watch Neil Manvar ( Sentry ) and Ramin Sedighi (Netlify) walk you through how to build and deploy Next. js applications with Netlify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found