Skip to content

[react native 0.82.0] Debug ID was not found in the bundle. Call options.sentryBundleCallback if you are using a custom serializer. #5250

@coder-xiaomo

Description

@coder-xiaomo

What React Native libraries do you use?

React Navigation, RN New Architecture

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

7.2.0

How does your development environment look like?

⬇  Place the `npx react-native@latest info` output here. ⬇

info Fetching system and libraries information...
System:
  OS: Windows 11 10.0.26100
  CPU: (22) x64 Intel(R) Core(TM) Ultra 9 185H
  Memory: 3.94 GB / 31.61 GB
Binaries:
  Node:
    version: 22.17.0
    path: D:\Program\Development\Environment\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Users\Coz\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 11.6.1
    path: D:\Program\Development\Environment\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.36429.23 (Visual Studio Enterprise 2022)
Languages:
  Java:
    version: 17.0.2
    path: D:\Program\Development\Environment\Java\jdk-17.0.2\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.82.0
    wanted: 0.82.0
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Sentry.init()

Sentry.init({
  dsn: 'https://[email protected]/...',

  // Adds more context data to events (IP address, cookies, user, etc.)
  // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
  sendDefaultPii: true,

  // Configure Session Replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1,
  integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],

  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
  // spotlight: __DEV__,
});

Steps to Reproduce

  1. create an react-native 0.82.0 repo (using gradle 9.0.0, by this patch: [android] Could not find method exec() for arguments when build after upgrade to gradle 9.0.0 (using react-native 0.82.0-rc.4) #5192 (comment))
  2. load an dynamic module like this:
const lazyComponent = React.lazy(() => import('./tabs/LazyLoadPage'))
...
<lazyComponent />
  1. run the app on real device (I am running on android 15 device)
  2. before load the lazyComponent the app run success
  3. load the lazyComponent (by click the button), the error raised:
Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.

the detail stack trace can be found below, and it seems like the function determineDebugIdFromBundleSource's problem (not very sure):

// Add debug id comment to the bundle
const debugId = determineDebugIdFromBundleSource(bundleCode);
if (!debugId) {
throw new Error(
'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',
);
}
// Only print debug id for command line builds => not hot reload from dev server
// eslint-disable-next-line no-console
console.log('info ' + `Bundle Debug ID: ${debugId}`);

determineDebugIdFromBundleSource was at here:

https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/40f918458ed449d8b3eabaf64d13c08218213f65/packages/bundler-plugin-core/src/debug-id-upload.ts#L293-L294

Expected Result

no error raised

Actual Result

stack trace:

 BUNDLE  src\views\pages\DebugMenu\tabs/DebugMenuAll.tsx
 ERROR  Error: Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.
    at E:\Project\spidermemos-app\node_modules\@sentry\react-native\dist\js\tools\sentryMetroSerializer.js:65:23
    at Generator.next (<anonymous>)
    at fulfilled (E:\Project\spidermemos-app\node_modules\@sentry\react-native\dist\js\tools\sentryMetroSerializer.js:5:58)
Image Image

Image

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions