Skip to content

Unable to resolve module promise/setimmediate/* #6614

Description

@kevinlinv

Context

Note: this is a continuation of #2147 that may have been closed based on a workaround, not an actual resolution.

Quoting this comment: #2147 (comment)

The issue seems to be that because only the react-native module lists this as a dependency, it is stored in the node_modules/react-native/node_modules/promise path. This will not be searched by Metro for this require.

Adding promise to the projects depenencies has the effect of moving the promise module to node_modules/promise, which is one of the paths that is searched.

The correct fix is for promise to be defined as a dependency of @sentry/react-native which should then correctly place the promise module in node_modules root.

Personally I would reopen this and fix the underlying issue as you shouldn't be requiring any modules that are not defined in your dependencies explicitly.

And this continues to happen to others, latest reported in May #2147 (comment), and this issue now.

What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.23.0

How does your development environment look like?

info Fetching system and libraries information...
System:
  OS: macOS 26.6.2
  CPU: (10) arm64 Apple M1 Max
  Memory: 235.25 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.12.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.6.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.03.11.00
    path: <home>/.nix-profile/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.5
      - iOS 26.5
      - macOS 26.5
      - tvOS 26.5
      - visionOS 26.5
      - watchOS 26.5
  Android SDK:
    API Levels:
      - "35"
      - "36"
      - "36"
    Build Tools:
      - 35.0.0
      - 36.0.0
      - 36.1.0
      - 37.0.0
    System Images:
      - android-35 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-36 | Google APIs ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2026.1 AI-261.26222.65.2613.16025427
  Xcode:
    version: 26.5/17F42
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.20
    path: /usr/bin/javac
  Ruby:
    version: 4.0.5
    path: /opt/homebrew/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

info React Native v0.87.0 is now available (your project is running on v0.85.3).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.87.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.85.3&to=0.87.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Sentry.init()

  Sentry.init({
    dsn: '<redacted>',
    environment: 'local',
    debug: true,
    enableNative: false,
  });

Steps to Reproduce

  • Setup Webpack + Re.Pack plugin for bundling
  • Install the react-native SDK
  • Import it, and receive an error about being unable to resolve module promises

Expected Result

No module promise resolution errror at bundle time.

Actual Result

✖ [10:03:23.020Z][LoggerPlugin] Failed to build bundle due to errors
✖ [10:03:23.020Z][LoggerPlugin] Error in "./node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlersutils.js":
Module not found: Error: Can't resolve 'promise/setimmediate/done' in '<project>/node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations'
✖ [10:03:23.020Z][LoggerPlugin] Error in "./node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlersutils.js":
Module not found: Error: Can't resolve 'promise/setimmediate/finally' in '<project>/node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations'
✖ [10:03:23.020Z][LoggerPlugin] Error in "./node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlersutils.js":
Module not found: Error: Can't resolve 'promise/setimmediate/es6-extensions' in '<project>/node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations'
✖ [10:03:23.020Z][LoggerPlugin] Error in "./node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlersutils.js":
Module not found: Error: Can't resolve 'promise/setimmediate/rejection-tracking' in '<project>/node_modules/.pnpm/@sentry+react-native@8.23.0_dotenv@10.0.0_react-native@0.85.3_patch_hash=481ba987eb41c2_50beefe4e6b9054b5124d446c14ad68d/node_modules/@sentry/react-native/dist/js/integrations'

Metadata

Metadata

Assignees

Projects

Status
Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions