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

Source map file is missing debugId after upload #3801

Closed
5 of 12 tasks
rajatkantinandi opened this issue May 6, 2024 · 2 comments
Closed
5 of 12 tasks

Source map file is missing debugId after upload #3801

rajatkantinandi opened this issue May 6, 2024 · 2 comments

Comments

@rajatkantinandi
Copy link

rajatkantinandi commented May 6, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android
  • Web

SDK:

  • @sentry/react-native (5.20.0)
  • react-native-sentry (<= 0.43.2)

Expo SDK version: 50.0.17

react-native version: 0.73.6

@sentry/cli version: 2.31.2

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

Link to issue

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  environment: process.env.ENV,
  sendDefaultPii: false,
  ...(Platform.OS === 'web' ? { release: Constants.expoConfig?.version } : {}),
  beforeSend(event) {
      // docs.sentry.io/platforms/react-native/data-management/sensitive-data/#scrubbing-data
      if (event.contexts?.device?.name) {
        delete event.contexts.device.name;
      }

      return event;
    },
});

I have the following issue:

I am uploading sourcemaps after generating using expo command: expo export --source-maps --platform web.
Upload command:

cd dist && npx sentry-cli sourcemaps upload --org <org-name> --project <project-name> --release=<release> --dist=<environment> _expo/static/js/web/

Before and after upload I checked both the .js and .js.map file and both of them contains the same debugId.
But after uploading when I go to sentry release, I see that the .js file has the debugId but .js.map file does not have debugId. See the screenshot:
Screenshot 2024-05-06 at 9 30 19 PM

As a result, when an error happens on the frontend it show stack trace of minified code.
Screenshot 2024-05-06 at 9 32 02 PM
It also says: "No Source Map With Matching Debug ID"
Screenshot 2024-05-06 at 9 32 26 PM

I am not sure why the debug id is missing from the uploaded .map file but present before upload when I check it by opening the file.

Also, I saw in the documentation mentioning that the source map file should have a property debug_id but my source map file has a property debugId instead. Is that why this is happening? Do you know how the sourcemap will have debug_id instead of debugId?

Steps to reproduce:

  • As described above.

Actual result:

Soucemap file is missing debugId and error shows minified code.

Expected result:

Soucemap file should have debugId and error should show the source code.

@krystofwoldrich
Copy link
Member

Hi @rajatkantinandi,
you are correct the debugId and debug_id difference is the reason why the source map is missing the Debug ID.

You can use our built-in script for uploading Expo source maps which takes care of these differences.

https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo/#upload-source-maps

SENTRY_PROJECT=android \
SENTRY_ORG=demo \
SENTRY_AUTH_TOKEN=Click to generate token \
npx sentry-expo-upload-sourcemaps dist

In case this has not helped, feel free to comment here and we can reopen the issue.

@rajatkantinandi
Copy link
Author

Thanks for the response.
Looks like the script you mention internally does this:

    if (sourceMap.debugId) {
      sourceMap.debug_id = sourceMap.debugId;
    }

Any reason why it is implemented this way?
Also, running npx sentry-expo-upload-sourcemaps dist does not associate the build with a release. Is there a way to do that with that script?

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

No branches or pull requests

2 participants