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 maps not uploading #364

Closed
rhys-jmc opened this issue Aug 8, 2023 · 49 comments
Closed

source maps not uploading #364

rhys-jmc opened this issue Aug 8, 2023 · 49 comments

Comments

@rhys-jmc
Copy link

rhys-jmc commented Aug 8, 2023

Summary

Source maps haven't been appearing in sentry since upgrading to Expo SDK v49 + sentry-expo v7. No errors are being thrown, just no Source Maps -> Artifact Bundles since July 7. We use EAS for builds.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

49.0.6

Environment

System:
OS: macOS 13.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.17.0 - /private/var/folders/7k/6cjxfzn55jx59ng8l7vbkh780000gn/T/xfs-58192736/node
Yarn: 3.6.1 - /private/var/folders/7k/6cjxfzn55jx59ng8l7vbkh780000gn/T/xfs-58192736/yarn
npm: 9.6.7 - /opt/homebrew/opt/node@18/bin/npm
Watchman: 2023.08.07.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
npmGlobalPackages:
eas-cli: 4.0.0
expo-cli: 6.3.8
Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

Not sure how to come up with a demo or how to debug this issue. With some guidance, I'd be happy to take some steps.

@mikevercoelen
Copy link

Same here, it's probably because the bundles are no longer .js files, they are .hbc files (hermes bytecode).

@josh-
Copy link

josh- commented Aug 13, 2023

@mikevercoelen assume you're talking about this change expo/expo#22098?

I've asked in that thread for some more details on the filename change.

@pavelbabenko
Copy link

Same issue

@mikevercoelen
Copy link

Expo hasn't replied to me after multiple attempts to post in their Discord, sadly.

We also have the issue with sourcemaps ever since we've moved our web export over to use the metro bundler.

I've created an issue on the Sentry React Native Github: getsentry/sentry-react-native#3244

@Kungpowpow
Copy link

Kungpowpow commented Aug 17, 2023

Same issue, same environment.
Does anyone know a workaround?

@robutler
Copy link

I'm seeing the same issue here for iOS with SDK 49.0.7, Sentry React-Native 5.5.0 and sentry-expo 7.0.0. Also using a managed build through EAS.
In the build log the task is executing as it should, and I'm not seeing any errors, but no artefacts in Sentry.
› Executing application » Upload Debug Symbols to Sentry

Android seems to work fine though, so for me at least it's just an iOS issue.

@josh-
Copy link

josh- commented Aug 21, 2023

We're only building for iOS, so that's a helpful data point that it works for Android @robutler - thanks.

@josh-
Copy link

josh- commented Aug 21, 2023

Here's an except of the "Xcode Logs" section of our EAS builds in case it could be helpful to anyone:

+ COMPOSE_SOURCEMAP_PATH=/Users/expo/workingdir/build/node_modules/react-native/scripts/compose-source-maps.js
+ [[ -z '' ]]
+ CONFIG_ARG=
+ BUNDLE_FILE=/Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/main.jsbundle
+ EXTRA_ARGS=
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ '[' '' = YES ']'
+ EMIT_SOURCEMAP=
+ [[ ! -z '' ]]
+ PACKAGER_SOURCEMAP_FILE=
+ [[ '' == true ]]
+ [[ '' != false ]]
+ [[ false == false ]]
+ EXTRA_ARGS=' --minify false'
+ /Users/expo/workingdir/build/node_modules/@sentry/cli/sentry-cli /Users/expo/workingdir/build/node_modules/@expo/cli/build/bin/cli export:embed --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/expo/Library/Developer/Xcode/DerivedData/App /Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/main.jsbundle --assets-dest /Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/App.app --minify false --sourcemap-output /Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/DerivedSources/main.jsbundle.map
warning: Bundler cache is empty, rebuilding (this may take a minute)
info Writing bundle output to:, /Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/main.jsbundle
info Writing sourcemap output to:, /Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/DerivedSources/main.jsbundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 56 asset files
info Done copying assets

// ...

Warning: build produced no sourcemaps.

// ...

+ sourceMap=/Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/DerivedSources/main.jsbundle.map

The presence of both Writing sourcemap output to: and Warning: build produced no sourcemaps. logs is suspicious.

@felixaa
Copy link

felixaa commented Aug 22, 2023

Same issue here.... I've been playing around a bit with the npx expo export --dump-sourcemap and trying to upload manually with the cli command as follows, without luck yet 🤔

Cli command:
$ node_modules/@sentry/cli/bin/sentry-cli releases files com.org.sampleproject@2.0.0+5 upload-sourcemaps --dist 5 --rewrite dist/bundles/main.jsbundle dist/bundles/main.jsbundle.map

The source maps gets uploaded but seems like the uploaded artifact is unable to be linked with the uploaded binary/release in Sentry... Would be great if we could get a reply from the author soon 😞

@MehdiSv
Copy link

MehdiSv commented Aug 22, 2023

Same issue, same environment.
Does anyone know a workaround?

@Kudo
Copy link

Kudo commented Aug 22, 2023

share my investigation in getsentry/sentry-react-native#3244 (comment) and see if sentry-cli can have a way to add the support.

@Fgabz
Copy link

Fgabz commented Aug 24, 2023

Same issue happening on iOS

@kevinlam92
Copy link

I've been running into this too. While trying to see what was going on during the eas builds, I also noticed using SENTRY_LOG_LEVEL=debug is a bit more verbose on Android builds while on iOS builds its radio silent (no indication of failing or even uploading anything).

@krystofwoldrich
Copy link
Contributor

Thank you @Kudo for sharing details in getsentry/sentry-react-native#3244. The issue is closed as it was not related to the Expo SDK 49 bundle command changes.

Sentry will update @sentry/cli to support the new Expo command. We will keep you updated here.

@krystofwoldrich
Copy link
Contributor

@mikevercoelen
Copy link

mikevercoelen commented Aug 29, 2023

@krystofwoldrich Awesome thanks! Does this incoming PR also include a fix for pushing eas update's? (this would be amazing)

@krystofwoldrich
Copy link
Contributor

@mikevercoelen No, it doesn't fix #335.

@josh-
Copy link

josh- commented Sep 1, 2023

Updating to @sentry/cli@2.20.6 has resolved the issue for us, and we're now getting automatic iOS source map uploads to Sentry when running in EAS 🎉

Thanks so much for helping to resolve this @Kudo & @krystofwoldrich - very appreciative 🙏

@rhys-jmc rhys-jmc closed this as completed Sep 1, 2023
@sperrys
Copy link

sperrys commented Sep 1, 2023

@josh- Are you using sentry-expo's plugin for the source map upload in eas?

@josh-
Copy link

josh- commented Sep 2, 2023

@sperrys yep - we're using the postPublish setup described in the docs here.

@josh-
Copy link

josh- commented Sep 2, 2023

Unsure if this is also related to Expo v49 but seems that our Sentry exceptions aren't being aren't being correctly symbolicated with our newly-uploaded source maps.

I see the original minified stack trace in Sentry, and when running the following command sentry-cli sourcemaps explain --org <ORG_HERE> --project <PROJECT_HERE> <EVENT_ID_HERE>, the following is printed:

✔ Fetched data for event: <EVENT_ID_HERE>
✔ Event has release name: <RELEASE_NAME_HERE>
✔ Event has a valid exception present
✔ Event has a valid stacktrace present
⚠ Exception is already source mapped and first resolved frame points to:

> [missing context line]

Will do some further digging but interested to know whether anyone else is encountering this also once their source maps are being successfully uploaded?

@krystofwoldrich
Copy link
Contributor

@josh- Thanks for the message, have you figured it out? If you are still having trouble, you can open an issue in sentry-react-native repository with details about the not symbolicated error.

@josh-
Copy link

josh- commented Sep 12, 2023

@krystofwoldrich realised that some errors weren't being symbolicated because they have a dist value that corresponds to an EAS update bundle ID, and that doesn't match an uploaded source map as a result of #335 🙂

@hrkls
Copy link

hrkls commented Sep 12, 2023

Same here, it's probably because the bundles are no longer .js files, they are .hbc files (hermes bytecode).

That was my conclusion as well, but how to get it working now??
i used to call eas-update in my script and then upload sourcemaps with sentry-cli, but now there's no jsbundle to upload in the output of eas-update 🤷

@normand1
Copy link

We stopped seeing symbolicated stack traces in Sentry after upgrading to Expo SDK 49 (we're also building on EAS). Today I updated our react native project to use @sentry/cli@2.20.7 and now I'm seeing source maps uploaded to Sentry again, but we're still not seeing new crashes with a stack trace as expected. One difference I've noticed is that Source Maps are showing up under the Artifact Bundles tab instead of Source Maps tab like they were before (I'm not sure what that means).

@felixaa
Copy link

felixaa commented Sep 14, 2023

One difference I've noticed is that Source Maps are showing up under the Artifact Bundles tab instead of Source Maps tab like they were before (I'm not sure what that means).

We have the same.. But we're just happy we have stack-traces on builds again. But now we need to figure out how we can manually upload source maps when we decide to push OTA updates. Any of you guys got some ideas on how to achieve this with the new @sentry/cli@2.20.6 and the sentry-expo@7.0.1?

@ssrballin
Copy link

Updating to @sentry/cli@2.20.6 has resolved the issue for us, and we're now getting automatic iOS source map uploads to Sentry when running in EAS 🎉

Thanks so much for helping to resolve this @Kudo & @krystofwoldrich - very appreciative 🙏

@josh- @Kudo @krystofwoldrich how do I incorporate this fix? I'm also on Expo SDK 49 and have followed the guide to set up sentry-expo correctly. However I see sentry-expo@v7.0.1 still uses @sentry/react-native(v5.5) which uses an older version of @sentry/cli which still doesn't upload the source maps correctly.

Do you guys mind sharing your package.json and/or eas build configuration which allows for them to get uploaded successfully?

Thank you 🙏

@Kungpowpow
Copy link

@ssrballin You can override the version by adding this to your package.json. I have mine working for now with this. You should remove this once the @sentry/cli version is officially updated.

"overrides": { "@sentry/react-native": { "@sentry/cli": "2.20.6" }, "sentry-expo": { "@sentry/react-native": { "@sentry/cli": "2.20.6" } } },

@ssrballin
Copy link

@Kungpowpow Thanks for the suggestion 🙏

I did try this out and unfortunately didn't work either :/ Errors are getting reported but there is no stack trace, I think source maps aren't uploading correctly like they used to (I would see a new release and 2 artifacts if they did upload successfully in the past)

package.json:

"engines": {
    "node": "v16.19.0",
    "npm": "8"
  },
  "dependencies": {
    ...
    "expo": "^49.0.10",
    "sentry-expo": "^7.0.1",
    "@sentry/react-native": "5.5.0"
  },
  "devDependencies": {
    ...
    "@sentry/cli": "^2.20.6"
  },
  "overrides": {
    "@sentry/react-native": {
      "@sentry/cli": "2.20.6"
    },
    "sentry-expo": {
      "@sentry/react-native": {
        "@sentry/cli": "2.20.6"
      }
    }
  },

app.json:

"plugins": [
      "sentry-expo",
      "@react-native-firebase/app",
      "expo-apple-authentication",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ]
    ],
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "filled",
            "project": "filled"
          }
        }
      ]
    },

Also:

  • SENTRY_AUTH_TOKEN is set in EAS secrets
  • in the logs I do see it running the upload step in fastlane, but no other seemingly sentry related output

@ssrballin
Copy link

ssrballin commented Sep 15, 2023

We stopped seeing symbolicated stack traces in Sentry after upgrading to Expo SDK 49 (we're also building on EAS). Today I updated our react native project to use @sentry/cli@2.20.7 and now I'm seeing source maps uploaded to Sentry again, but we're still not seeing new crashes with a stack trace as expected. One difference I've noticed is that Source Maps are showing up under the Artifact Bundles tab instead of Source Maps tab like they were before (I'm not sure what that means).

Experiencing the same, some kind of mismatch going on

I was able to resolve by removing my release config from Sentry.init(...) @normand1

Everything is working now, thank you @Kungpowpow and everyone! 🥳

@Kudo
Copy link

Kudo commented Sep 16, 2023

currently latest @sentry/react-native@5.9.1 doesn't have @sentry/cli@2.20.6 yet. from expo, we would may wait to fix the version from npx expo install until newer @sentry/react-native.

if there's still symbolicated stack trace problem and having an easier repro, let me know what we could help.

@yqkqknct
Copy link

currently latest @sentry/react-native@5.9.1 doesn't have @sentry/cli@2.20.6 yet. from expo, we would may wait to fix the version from npx expo install until newer @sentry/react-native.

if there's still symbolicated stack trace problem and having an easier repro, let me know what we could help.

It seems that now @sentry/react-native@5.9.2 has incorporated @sentry/cli@2.20.7 already. Could we bump the version of @sentry/react-native@5.9.2 to fix this issue? Thanks!

@felixaa
Copy link

felixaa commented Oct 11, 2023

We have the same.. But we're just happy we have stack-traces on builds again. But now we need to figure out how we can manually upload source maps when we decide to push OTA updates. Any of you guys got some ideas on how to achieve this with the new @sentry/cli@2.20.6 and the sentry-expo@7.0.1?

bump. Anyone figured out how to upload source-maps on EAS Update, and not only on build yet?

@sem4phor
Copy link

I cannot even get sourcemaps for EAS builds :/ Is there a way to see that / which sourcemaps are uploaded?

@josh-
Copy link

josh- commented Oct 13, 2023

bump. Anyone figured out how to upload source-maps on EAS Update, and not only on build yet?

@felixaa see this issue: #335

I cannot even get sourcemaps for EAS builds :/ Is there a way to see that / which sourcemaps are uploaded?

@sem4phor you can view uploaded source maps by going to project settings in Sentry and clicking "Source Maps" under "Processing".

@sem4phor
Copy link

@josh- and is there a way to track in the EAS build if the hook is executed to upload them? I followed all instructions installed the plugin etc. but no sourcemaps are getting uploaded :/

@josh-
Copy link

josh- commented Oct 15, 2023

@sem4phor for iOS, open the logs in the "Xcode Logs" section of an EAS build:

image

And and you should notice log lines like:

info Writing sourcemap output to:, /Users/expo/Library/Developer/Xcode/DerivedData/App/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/DerivedSources/main.jsbundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 56 asset files
info Done copying assets

and then further down:

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Bundle ID: <ID_HERE>
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: orghere
> Project: orghere-app
> Release: com.app.app@0.0.1+100
> Dist: 100
> Upload type: artifact bundle

Source Map Upload Report
  Minified Scripts
    ~/main.jsbundle (sourcemap at main.jsbundle.map)
  Source Maps
    ~/main.jsbundle.map

@sem4phor
Copy link

After building for "preview" I get some logs regarding sourcemaps on ios (whereas on the simulator build I did not get anything related to them):

+ [[ ! -f /Users/expo/Library/Developer/Xcode/DerivedData/justTRADE-ftmpmlehusnoovdcofosoiisqbak/Build/Intermediates.noindex/ArchiveIntermediates/XXX/BuildProductsPath/Release-iphoneos/XXX.app/main.jsbundle ]]
Warning: build produced no sourcemaps.

then further down:

Sentry Logger [info]: Reading source map from /Users/expo/Library/Developer/Xcode/DerivedData/XXX-ftmpmlehusnoovdcofosoiisqbak/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/XXX.build/Release-iphoneos/XXX.build/DerivedSources/main.jsbundle.map
Sentry Logger [info]: Saving modules to /Users/expo/Library/Developer/Xcode/DerivedData/XXX-ftmpmlehusnoovdcofosoiisqbak/Build/Intermediates.noindex/ArchiveIntermediates/XXX/BuildProductsPath/Release-iphoneos/XXX.app/modules.json
Sentry Logger [info]: Resolving modules from paths /Users/expo/Library/Developer/Xcode/DerivedData/XXX-ftmpmlehusnoovdcofosoiisqbak/Build/Intermediates.noindex/ArchiveIntermediates/XXX/BuildProductsPath/Release-iphoneos/XXX.app/modules.json
Sentry Logger [info]: Modules collected and saved to: /Users/expo/Library/Developer/Xcode/DerivedData/XXX-ftmpmlehusnoovdcofosoiisqbak/Build/Intermediates.noindex/ArchiveIntermediates/XXX/BuildProductsPath/Release-iphoneos/XXX.app/modules.json

And in the end no release or sourcemaps are added to sentry. I followed every step in the docs :( and I use the latest package versions of expo / rn etc.

@krystofwoldrich
Copy link
Contributor

@sem4phor Warning: build produced no sourcemaps. will be fixed by #374

Till then can you manually update @sentry/cli? npm install @sentry/cli@latest --save-dev

@krystofwoldrich
Copy link
Contributor

@felixaa Have you seen some of the solutions from #335 for the EAS Update?
That might help till it's supported directly by the package.

@sem4phor
Copy link

@krystofwoldrich unfortunaltyl updating manually breaks my build

@emilje
Copy link

emilje commented Oct 27, 2023

For OTA , we had luck getting it to work by renaming the .hbc files to index.android.bundle for android and to main.jsbundle for ios and uploading those along with the .map files.

@Ross-Landry
Copy link

@emilje

I created this bash script that renames the files for me and uploads them to Sentry.


#!/bin/bash

ORGANIZATION = # The name of your org, can be found in Sentry console
BUNDLE_ID = # bundleIdentifier found in your app config file
SENTRY_PROJECT_BETA = # The name of your beta project, can be found in Sentry console
SENTRY_PROJECT_PRODUCTION = # The name of your project, can be found in Sentry console

################### Step 1 - Take Profile, Version, And Update Id's ############

# Accept command-line arguments
PROFILE="$1" # production, production-beta, staging, etc
IOS_UPDATE_ID="$2" # is an output of the eas update command
ANDROID_UPDATE_ID="$3" # is an output of the eas update command
RELEASE_VERSION="$4" 
ANDROID_BUILD_NUMBER="$5"

# Check if all required arguments are provided
if [ -z "$PROFILE" ] || [ -z "$IOS_UPDATE_ID" ] || [ -z "$ANDROID_UPDATE_ID" ] || [ -z "$RELEASE_VERSION" ]; then
    echo "Usage: $0 <PROFILE> <IOS_UPDATE_ID> <ANDROID_UPDATE_ID> <RELEASE_VERSION>"
    exit 1
fi

# Determine Sentry project based on the profile
if [ "$PROFILE" == "production" ]; then
    PROJECT=$SENTRY_PROJECT_PRODUCTION
else
    PROJECT=$SENTRY_PROJECT_BETA
fi

echo "Using Profile: $PROFILE"
echo "Using Sentry Project: $PROJECT"
echo "Using iOS Update ID: $IOS_UPDATE_ID"
echo "Using Android Update ID: $ANDROID_UPDATE_ID"
echo "Using Latest Build Version: $RELEASE_VERSION"

################### Step 2 - Rename Bundle Files ############

echo "Renaming the source map and bundle files..."
# Assuming the original file is ios-*.hbc in dist/bundles
ORIGINAL_IOS_BUNDLE=$(find dist/bundles -name 'ios-*.hbc' -type f)
# Check if the file was found
if [ -z "$ORIGINAL_IOS_BUNDLE" ]; then
    echo "Error: No iOS HBC file found in the specified location."
    exit 1
fi
# Rename the file to main.jsbundle
RENAMED_IOS_BUNDLE=$(dirname "$ORIGINAL_IOS_BUNDLE")/main.jsbundle
mv "$ORIGINAL_IOS_BUNDLE" "$RENAMED_IOS_BUNDLE"
# Print a message indicating the renaming
echo "File $ORIGINAL_IOS_BUNDLE has been renamed to $RENAMED_IOS_BUNDLE"
# Assuming the original file is android-*.hbc in dist/bundles
ORIGINAL_ANDROID_FILE=$(find dist/bundles -name 'android-*.hbc' -type f)
# Check if the file was found
if [ -z "$ORIGINAL_ANDROID_FILE" ]; then
    echo "Error: No Android HBC file found in the specified location."
    exit 1
fi
# Rename the Android file to index.android.bundle
RENAMED_ANDROID_BUNDLE=$(dirname "$ORIGINAL_ANDROID_FILE")/index.android.bundle
mv "$ORIGINAL_ANDROID_FILE" "$RENAMED_ANDROID_BUNDLE"
# Print a message indicating the renaming
echo "File $ORIGINAL_ANDROID_FILE has been renamed to $RENAMED_ANDROID_BUNDLE"

################### Step 3 - Locate Source Maps ############

# Find the iOS map file in the specified location
IOS_MAP_FILE=$(find dist/bundles -name 'ios-*.map' -type f)
# Check if the file was found
if [ -z "$IOS_MAP_FILE" ]; then
    echo "Error: No iOS map file found in the specified location."
    exit 1
fi
echo iOS map file found
# Find the Android map file in the specified location
ANDROID_MAP_FILE=$(find dist/bundles -name 'android-*.map' -type f)
# Check if the file was found
if [ -z "$ANDROID_MAP_FILE" ]; then
    echo "Error: No Android map file found in the specified location."
    exit 1
fi
echo Android map file found

################### Step 4 - Get Android build number from EAS config ############

# Run eas config command and capture the output
EAS_CONFIG_OUTPUT=$(eas config --profile $PROFILE --platform ios)
# Extract version numbers using sed
ANDROID_BUILD_NUMBER=$(echo "$EAS_CONFIG_OUTPUT" | sed -nE 's/.*"versionCode": ([0-9]+).*/\1/p')
echo "Android build number found: $ANDROID_BUILD_NUMBER"

################### Step 5 - Upload Source Maps ############

# Log into Sentry
sentry-cli login
# iOS
echo Uploading iOS source map...
sentry-cli releases --org $ORGANIZATION --project $PROJECT files $BUNDLE_ID@$RELEASE_VERSION+1 upload-sourcemaps --dist $IOS_UPDATE_ID --rewrite dist/bundles/main.jsbundle "$IOS_MAP_FILE" 
# Android
echo Uploading Android source map...
sentry-cli releases --org $ORGANIZATION --project $PROJECT files $BUNDLE_ID@$RELEASE_VERSION+$ANDROID_BUILD_NUMBER upload-sourcemaps --dist $ANDROID_UPDATE_ID --rewrite dist/bundles/main-android.bundle "$ANDROID_MAP_FILE" 

echo Done.
exit 0

@Ross-Landry
Copy link

Ross-Landry commented Nov 20, 2023

The script I shared above can be invoked as a side effect of the OTA update, getting all the arguments automatically. This is a snippet from a different bash script I use eas update.

Note: Here I'm hard-coding the channel to be "production-beta" because this particular script is for pushing OTAs for the beta channel. I have a different script for pushing to production.

    while true; do
        read -p "This action will push to all beta clients using production data. Are you sure you want to proceed? (y/n) " yn
        case $yn in
            [Yy]* ) 
            # EAS Update
            echo "Running EAS Update..."
            EAS_UPDATE_OUTPUT=$(npx eas update --channel production-beta --auto --non-interactive)
            # Extract iOS and Android update IDs using grep and awk
            IOS_UPDATE_ID=$(echo "$EAS_UPDATE_OUTPUT" | grep "iOS update ID" | awk '{print $4}')
            ANDROID_UPDATE_ID=$(echo "$EAS_UPDATE_OUTPUT" | grep "Android update ID" | awk '{print $4}')
            # Upload Sentry source maps
            echo "Uploading source maps to Sentry..."
            ./scripts/source-map-upload.sh "production-beta" "$IOS_UPDATE_ID" "$ANDROID_UPDATE_ID" "$RELEASE_TAG"
            break;;
            [Nn]* ) exit;;
            * ) echo "Please answer yes or no.";;
        esac
    done

@fatlinesofcode
Copy link

fatlinesofcode commented Dec 19, 2023

this works for me

npx expo export --platform ios --dump-sourcemap
mv dist/bundles/ios-*.map dist/bundles/main.jsbundle.map
mv dist/bundles/ios-*.js dist/bundles/main.jsbundle
/./../node_modules/@sentry/cli/bin/sentry-cli releases files ${PACKAGE_ID}@${VERSION}+${VERSION}.${BUILD_NUMBER} upload-sourcemaps dist/bundles

@krystofwoldrich
Copy link
Contributor

Hello everyone,
@sentry/react-native now supports Expo out of the box!

EAS Updates source maps upload is now as easy as npx sentry-expo-upload-sourcemaps dist.

Update to https://github.com/getsentry/sentry-react-native/releases/tag/5.16.0 or newer to get all the new features.

Migration guides available:

@peterpme
Copy link

peterpme commented Feb 9, 2024

Hello! I've been scratching my head: does this package exist? I tried accessing it on npmjs.com and didn't see it on there either. Just want to confirm I'm not doing something silly.

Thank you!

❯ npx sentry-expo-upload-sourcemaps
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/sentry-expo-upload-sourcemaps - Not found
npm ERR! 404
npm ERR! 404  'sentry-expo-upload-sourcemaps@*' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

@josh-
Copy link

josh- commented Feb 9, 2024

@peterpme I believe you need to run npx sentry-expo-upload-sourcemaps in the context of a project that already has @sentry/react-native installed.

This is because recent versions of @sentry/react-native include the sentry-expo-upload-sourcemaps binary, which is located inside ./node_modules/.bin - that is what npx will use. (there is no separate sentry-expo-upload-sourcemaps package)

@hrkls
Copy link

hrkls commented Feb 9, 2024

according to expo50 changelog (https://expo.dev/changelog/2023/12-12-sdk-50-beta)

sentry-expo will be deprecated in favor of @sentry/react-native. The sentry-expo package will continue to work in SDK 50, but it will be deprecated and we recommend moving to @sentry/react-native. This change allows us to deduplicate efforts and ensure a better, always up to date experience for folks that use Sentry in their projects. We’ll update this post with information about how to migrate soon.

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

No branches or pull requests