Skip to content
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

Compilation error after upgrading to @sentry/react 7.1.0 #5222

Closed
3 tasks done
kapso opened this issue Jun 7, 2022 · 5 comments
Closed
3 tasks done

Compilation error after upgrading to @sentry/react 7.1.0 #5222

kapso opened this issue Jun 7, 2022 · 5 comments
Assignees

Comments

@kapso
Copy link

kapso commented Jun 7, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/react

SDK Version

7.1.0

Framework Version

18.1.0

Link to Sentry event

No response

Steps to Reproduce

Upgrade from 7.0.0 to 7.1.0

Expected Result

Successful compilation.

Actual Result

Compilation error -

Compiling...
       Compilation failed:
       ModuleNotFoundError: Module not found: Error: Can't resolve 'cookie' in '/tmp/build_0b2ca099/node_modules/@sentry/utils/esm'
           at /tmp/build_0b2ca099/node_modules/webpack/lib/Compilation.js:925:10
           at /tmp/build_0b2ca099/node_modules/webpack/lib/NormalModuleFactory.js:401:22
           at /tmp/build_0b2ca099/node_modules/webpack/lib/NormalModuleFactory.js:130:21
           at /tmp/build_0b2ca099/node_modules/webpack/lib/NormalModuleFactory.js:224:22
           at /tmp/build_0b2ca099/node_modules/neo-async/async.js:2830:7
           at /tmp/build_0b2ca099/node_modules/neo-async/async.js:6877:13
           at /tmp/build_0b2ca099/node_modules/webpack/lib/NormalModuleFactory.js:214:25
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:213:14
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
           at /tmp/build_0b2ca099/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
           at _next43 (eval at create (/tmp/build_0b2ca099/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
       resolve 'cookie' in '/tmp/build_0b2ca099/node_modules/@sentry/utils/esm'
         Parsed request is a module
         using description file: /tmp/build_0b2ca099/node_modules/@sentry/utils/package.json (relative path: ./esm)
@kapso kapso added the Type: Bug label Jun 7, 2022
@kapso kapso changed the title Compilation error when upgrading to @sentry/react 7.1.0 Compilation error after upgrading to @sentry/react 7.1.0 Jun 7, 2022
@esetnik
Copy link

esetnik commented Jun 7, 2022

I am facing a similar issue:

$ CI=true REACT_APP_RELEASE=$(npx sentry-cli releases propose-version) react-scripts build
Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve 'url' in '/redacted/node_modules/@sentry/utils/esm'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
	- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "url": false }


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1

@AbhiPrasad
Copy link
Member

Hey folks, thanks for writing in! We're investigating the issue and we'll update as soon as we can!

@AbhiPrasad
Copy link
Member

It seems like #5190 added node.js imports, which don't exist in a browser context. I'm surprised though that our Playwright integration tests didn't catch these.

For the time being, we're going to revert the above PR and cut a release to unblock you folks.

@dermoumi
Copy link

dermoumi commented Jun 7, 2022

@AbhiPrasad #5190 adds the [email protected] package as a peer dependency, installing it fixes the issue for me.

But it causes other issues with projects that use cookie@5 instead.

I suggest having it as a normal dependency instead...

AbhiPrasad added a commit that referenced this issue Jun 7, 2022
)" (#5223)

This reverts commit 7c521e3.

This PR causes issues with users as reported here: #5222. This is because we added Node library imports in the utils package - which can be consumed in browser contexts.
@vladanpaunovic
Copy link
Contributor

Hey folks, we released a fix in 7.1.1.

Thanks, @AbhiPrasad and @lobsterkatie for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants