sentry-react-native: Issue with source maps and missing artifacts
Environment
How do you use Sentry?
- Sentry SaaS (sentry.io)
Which SDK and version?
sentry-expo
:3.0.4
@sentry/react-native
:2.2.0
Steps to Reproduce
- Run my app (either via
yarn ios
or from within Xcode) – let’s say version0.0.35
, build76
- See a new release called
0.0.35 (76)
in the Sentry project - Check the release and see that there are 0 artifacts
Expected Result
Artifacts would be available.
Actual Result
There are 0 artifacts in the release.
Setup information
I started my project as an Expo managed app and eventually ejected to the bare workflow.
Everything was working as expected (source maps and artifacts were available) while on @sentry/react-native
version 1.9.0
but things broke when I upgraded to 2.1.0
and they haven’t been right since, regardless of what I’ve tried. Looking through the Source Maps section in Sentry, I last see a release with artifacts just before I did the 1.9.0
-> 2.1.0
upgrade but none since. Looking back at my changes then, I know I did something wrong – I started using:
import * as Sentry from '@sentry/react-native'
instead of import { Native as Sentry } from 'sentry-expo'
Since then, I’ve resorted to using import { Native as Sentry } from 'sentry-expo'
again after trying to debug this with somebody from Expo – I was told that I didn’t need to use sentry-expo
as well as @sentry/react-native
but that it’d give some extra features if I did.
Here’s some setup information:
sentryConfig.ts
import { Platform } from 'react-native'
import { Native as Sentry } from 'sentry-expo'
const SENTRY_DSN_IOS = 'xxx'
const SENTRY_DSN_ANDROID = 'xxx'
export const sentryConfig: Sentry.ReactNativeOptions = {
dsn: Platform.OS === 'ios' ? SENTRY_DSN_IOS : SENTRY_DSN_ANDROID,
enableAutoSessionTracking: true,
debug: __DEV__ ? true : false,
environment: __DEV__ ? 'development' : 'production',
}
App.tsx
import { Native as Sentry } from 'sentry-expo'
Sentry.init(sentryConfig)
// Sentry.captureException(error)
sentry.properties
defaults.url=https://sentry.io/
defaults.org=xxx
defaults.project=xxx
auth.token=xxx
cli.executable=node_modules/@sentry/cli/bin/sentry-cli
Xcode – Bundle React Native code and images
export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
export SENTRY_PROPERTIES=sentry.properties
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh
../node_modules/expo-constants/scripts/get-app-config-ios.sh
../node_modules/expo-updates/scripts/create-manifest-ios.sh
Xcode – Upload Debug Symbols to Sentry
export SENTRY_PROPERTIES=sentry.properties
../node_modules/@sentry/cli/bin/sentry-cli upload-dsym
Am I missing a manual step here or is there maybe an issue with my setup? I thought that when running/building a new version/build, a new Sentry release would automatically be created and everything would be handled. Here’s a screenshot of the Tags in a recent issue (from a release that has 0 artifacts):

I can see that dist
is clearly taken from my build
number and release
is a combination of the version
and the build
numbers. This is clearly done automatically as I don’t set that explicitly anywhere.
The only way I’ve been able to create a new release and get artifacts/source maps is if I run expo publish
manually. When doing this, I get a new release created but it has a name like 0.0.35-r.-DrbHnWJw
and no issues seem to show up under that release. That release, however, does have artifacts, e.g.

whereas the automatically-created releases don’t:

Apologies for the length of this issue but I’ve been stuck with this for a while now and I wanted to give as much context as possible, hoping that it’s simply a setup issue on my side. Thanks in advance! Have a a nice day.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (10 by maintainers)
This is a big problem.
There’s nothing in the docs about it, just says “by default sourcemaps are uploaded with the react native sdk”
luckily found this issue, and was able to add
--force-foreground
and now i can see errors and the stack trace.I just installed the latest version today and it wasn’t working, would be good to get this patched.
Ok I’ve successfully reproduced it as well, if you add the flag
--force-foreground
to the build script in Xcode it seems to work.So try replacing the “Bundle React Native code and images” build script with this, and see if it works? @darrylyoung @cruzach
I’ll be raising this issue to others internally I don’t know why it does this.
What pops out to me as unusual is
0.0.35 (76)
should not be automatically generated by us as this does not match our release name scheme of{app_identifier}@{version}+{dist}
: as you can see here. So I’m not sure where this is coming from.Also, given that it’s what’s being set inside the event as well, means this value is being set during runtime somewhere as well, maybe auto-set by sentry-expo?
The team over at
sentry-expo
would probably know more about this than I do, so cc @cruzach.The same happens for me as well. I’m not using expo, but a raw RN project. Android works perfectly fine and source maps are uploaded automatically. On iOS I do see the info “Sentry: React Native symbol handling started” when archiving with XCode, but they never show up as artifacts in an iOS Release on Sentry.
After reading through this issue I tried using
--force-foreground
as well - as can be seen in the above XCode configuration -, but to no avail. I’m using@sentry/react-native v2.4.2
currently.Edit: My bad, I added
--force-foreground
to the wrong build phase, after correctly applying it to “Bundle React Native code and images" it now correctly uploaded the 2 artifacts for the new release”,Just reproduced this on a blank-ish bare workflow app @darrylyoung - after building for release in Xcode (and seeing that the “Upload sourcemaps” shell script was run: no artifacts for that release in Sentry dashboard- but only on iOS (Android sourcemaps were uploaded perfectly fine during
./gradlew assembleRelease
)Will update here if I figure out what’s going on here