Sentry-react-native: Unable to resolve module `./dsn` from `node_modules/@sentry/core/dist/index.js`

Created on 4 Feb 2020  ·  2Comments  ·  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [x] iOS
  • [ ] Android

SDK:

  • [x] @sentry/react-native
  • [ ] react-native-sentry

react-native version: 1.2.2

  • Other possible relevant information if necessary*
    cocoapods version: 1.7.5 and 1.8.4
    npm version: 6.11.3
    node version: 10.17.0

I have following issue:

Getting a compile time error with the following stacktrace:

error: bundling failed: Error: Unable to resolve module `./dsn` from `node_modules/@sentry/core/dist/index.js`:
None of these files exist:
  * node_modules/@sentry/core/dist/dsn(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
  * node_modules/@sentry/core/dist/dsn/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
    at ModuleResolver.resolveDependency (/Users/eaa/git/app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/Users/eaa/git/app/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/eaa/git/app/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
    at Object.resolve (/Users/eaa/git/app/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at dependencies.map.result (/Users/eaa/git/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31)
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/eaa/git/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
    at /Users/eaa/git/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/eaa/git/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)

I was able to fix it locally by downgrading @sentry/react-native to 1.2.0. With the downgrade, our package-lock-file received upgraded dependencies. An example shown in this image:
Screenshot 2020-02-04 at 08 43 52

I'm quite new to using sentry, so I don't think I'm qualified to say whether or not this is in fact the issue.

It seems like this have been an issue in the past (https://github.com/getsentry/sentry-react-native/issues/724), but deleting node_modules / Pods did not help. I even tried deleting the whole project and cloning it from github once again, but to no avail. Might be a regression issue 🤷‍♂️

Steps to reproduce:

  1. Bumped @sentry/react-native from 0.9.7 to 1.2.2.
  2. npm install
  3. pod install
  4. react-native run-ios --scheme Debug --configuration Debug --simulator="iPhone 11"
  5. react-native start // Here comes the crash.

Actual result:
Compile time error

Expected result:
No compile time errors.

PS. First-time issue-opener on open-source projects, just let me know if you need more information

Most helpful comment

Hey, thanks for the detail issue, can you try to run
react-native start --reset-cache, it must be a caching issue somewhere, I just ran a clean example locally and it worked just fine.

All 2 comments

Hey, thanks for the detail issue, can you try to run
react-native start --reset-cache, it must be a caching issue somewhere, I just ran a clean example locally and it worked just fine.

Hi again!

After clearing almost every single tmp/cache/pods/node_modules-folder we were able to locate, we finally turned the machine off and on again, and yet again The IT-crowd was correct.

Sorry I didn't close the issue sooner, and thanks for your followup.

Was this page helpful?
0 / 5 - 0 ratings