exposentrysource-maps

Sentry sourcemaps not working for Expo 49 builds


I had a script that ran

eas update --branch <DEVELOPMENT> --non-interactive --auto --json

and then called sentry-cli upload-sourcemaps to upload output of eas update to sentry.

However, it stopped working after upgrading to expo 49 because eas update produces .hbc files instead of js bundle as before.

Any ideas on how to get sentry sourcemaps working again with Hermes?

I have tried following the guide from https://docs.sentry.io/platforms/react-native/manual-setup/hermes/

and then run the eas update with --skip-bundler option, but the over-the-air update was not applied. I assume that's because it was build not the way expo wants it. That's when I thought there must be a better way...


Solution

  • I am trying to get this set up on a new project altogether starting with Expo 49. Running eas update produces a dist folder, and in that dist folder, I get bundles for <platform>-<update-id>.hbc as well as <platform>-<update-id>.map.

    Changing the .hbc file name to index.android.bundle and then running the sentry-cli upload-sourcemaps command with the correct dist and ID got sourcemaps uploaded correctly—e.g.,

    node_modules/@sentry/cli/bin/sentry-cli releases \
        files <release name> \
        upload-sourcemaps --org <org-slug> --project <project-slug> \
        --dist <Android Update ID> \
        --rewrite \
        dist/bundles/index.android.bundle dist/bundles/android-<hash>.map
    

    Edit: I have only tested this with Android so far, but I presume changing the file name for the iOS bundle and then running the sentry-cli upload-sourcemaps command will produce similar results.

    Edit again: Tested and confirmed this works on iOS! Just rename the outputted ios-<hash>.hbc -> main.jsbundle and use the recommended template for the iOS sourcemaps:

    node_modules/@sentry/cli/bin/sentry-cli releases \
        files <${bundleIdentifier}@${version}+${buildNumber}> \
        upload-sourcemaps --org <org-slug> --project <project-slug> \
        --dist <iOS Update ID> \
        --rewrite \
        dist/bundles/main.jsbundle dist/bundles/ios-<hash>.map