getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

@sentry/nextjs: Next.js build fails with Webpack 4 + next-offline #4133

Closed jasonadkison closed 2 years ago

jasonadkison commented 2 years ago

Package + Version

Version:

6.14.1

Description

Ref: #3613

Our app uses Next.js v11 and Webpack 4. When building a service worker with workbox via next-offline, withSentryConfig causes our builds to fail with the following error:

You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer

We are not able to upgrade our project to Webpack 5, as was previously recommended.

Here's a link to the repo where the issue can be reproduced: https://github.com/jasonadkison/next-sentry-error/

giulioambrogi commented 2 years ago

any workaround while this is being looked at?

onurtemizkan commented 2 years ago

Hi @jasonadkison,

I was able to reproduce the error in the project you provided, and deleting and recreating package-lock.json using npm@8.11.0 fixed it for me. Also, removing package-lock.json and using yarn instead worked well both locally and on Vercel.

The issue seems originated from the dependency resolution of source-map package. That specific package-lock.json (lockfile version 1) somehow favours an earlier (buggy) version of it.

Closing the issue, as I can't see a way to action this on the SDK side at the moment. But feel free to reopen if that doesn't work.