How do you use Sentry?
Which SDK and version?
sentry-expo: 3.0.4@sentry/react-native: 2.2.0yarn ios or from within Xcode) – let's say version 0.0.35, build 760.0.35 (76) in the Sentry projectArtifacts would be available.
There are 0 artifacts in the release.
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.
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.
In sentry-expo, we default to Sentry's default (because we want all the errors for build-time sourcemaps to be mapped correctly 😄 ), as you can see here:
nativeOptions.release = `${Application.applicationId}@${Application.nativeApplicationVersion}+${Application.nativeBuildVersion}`;
So maybe you are passing in a release somewhere to your sentry initialization? Or is there an environment variable that is maybe overwriting the default (this is probably more relevant for the actual artifacts that are being uploaded, since env vars in react native apps aren't really a thing)
Is there anything in the xcode build logs that indicate those build scripts for uploading sourcemaps are failing?
Now that I looked at this a second time with fresh eyes, I'm reminded that Sentry dashboard creates a new release for events with release names that don't match any existing ones. So that's probably what you're seeing with the empty releases, so I would look at whatever is setting that value during runtime.
Hi, guys. Thanks for looking into this for me – it's very much appreciated!
So maybe you are passing in a release somewhere to your sentry initialization?
I'm not explicitly passing release anywhere as far as I can see, nor do I remember ever doing so. My Sentry config is shown above.
Or is there an environment variable that is maybe overwriting the default
As with the previous point, I haven't explicitly set anything like that so unless a version of sentry-expo or @sentry/react-native did that, I can't see this being the issue.
Does my overall setup look correct? Also, do you have any specific places where you suggest I could look for anything else? I've covered as much as I can in the original post above but if there's anything else then I'd be happy to send it as well.
Thanks again, guys. Have a great day and weekend ahead.
Could it maybe be related to how I'm updating builds? Right now, let's say I'm on version 0.0.35 with build number 81 and I want to increment my build number but keep the same version, I'd do the following:
buildNumber in app.jsonBuild in my project targetWhether the last step is running locally or building an Archive for upload, a new Release will be created in Sentry. In the case of this example, it'd be 0.0.35 (82).
app.json
{
"name": "xxx",
"displayName": "xxx",
"expo": {
"name": "xxx",
"slug": "xxx",
"version": "0.0.35",
"sdkVersion": "40.0.0",
"description": "xxx",
"privacy": "unlisted",
"platforms": ["ios", "android"],
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "xxx",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#f9f9f9"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"buildNumber": "82",
"bundleIdentifier": "xxx",
"supportsTablet": false,
"usesAppleSignIn": true,
"infoPlist": {
"LSApplicationQueriesSchemes": ["instagram", "twitter", "fb"]
},
"config": {
"usesNonExemptEncryption": false,
"googleSignIn": {
"reservedClientId": "xxx"
}
}
},
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "xxx",
"project": "xxx-ios",
"authToken": "xxx"
}
}
]
},
"android": {
"package": "xxx"
}
}
}
Xcode – Increment Build

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
Actually, looks like the issue I'm running into is https://github.com/getsentry/sentry-react-native/issues/888
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
export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
export SENTRY_PROPERTIES=sentry.properties
export SENTRY_LOG_LEVEL="info"
# If you are using RN 0.46+
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode --force-foreground
I'll be raising this issue to others internally I don't know why it does this.
Hi, @jennmueng. Thanks for the suggestion. I just tried that and I can see 2 artifacts in the new release. There have been 0 artifacts in previous releases so this clearly helped.
For context, I used the following and the only change was the addition of --force-foreground.
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 --force-foreground ../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

Thanks to both of you for your help so far with this.
_Update: I just saw an issue for that latest release (the one with 2 artifacts) and at the top of the issue I see:_
There was 1 error encountered while processing this event
Source code was not found
Url | /var/mobile/Containers/Data/Application/xxx/Library/Application Support/.expo-internal/bundle-xxx
@darrylyoung That error at the top looks like the source map filename was not mapped correctly, it should be replaced to app:///main.jsbundle by sentry-expo: https://github.com/expo/sentry-expo/blob/86b93c845fa66f0fc20e16b175793058e6a861e1/src/sentry.ts#L52
Edit: Oh I looked at your initial issue—if you're still using expo you should call not call the init from Native but use the normal one from * as Sentry from "sentry-expo"
Hi again, @jennmueng. Thanks for the suggestion. I've just made that change and I still have that same issue.
There was 1 error encountered while processing this event
Source code was not found
Url | /var/mobile/Containers/Data/Application/xxx/Library/Application Support/.expo-internal/bundle-xxx
For context, here's my setup after your suggestion:
sentry.config
import { Platform } from 'react-native'
const SENTRY_DSN_IOS = 'xxx'
const SENTRY_DSN_ANDROID = 'xxx'
export const sentryConfig = {
dsn: Platform.OS === 'ios' ? SENTRY_DSN_IOS : SENTRY_DSN_ANDROID,
enableInExpoDevelopment: true,
enableAutoSessionTracking: true,
debug: __DEV__ ? true : false,
environment: __DEV__ ? 'development' : 'production',
}
App.tsx
import * as Sentry from 'sentry-expo'
Sentry.init(sentryConfig)
// Sentry.Native.captureException(error)
package.json
"@sentry/react-native": "^2.2.1",
"sentry-expo": "^3.0.4",
I'm also seeing the following in the issue, in case that helps:

Update
Actually, I have two new issues in this new release and one of them has no messages/warnings about source code not being found while the other does. The one with the _source code not found_ message looks like this:

I've since had another issue show up and it came at the exact same time as another issue which looked like the one above. That is, it seems like issues come through _normally_ but also come with an issue that's somehow related but has no source maps, etc.
I'm facing this issue too with SDK 1.9.0 as well as 2.1.0. My setup is more similar to the one in #888 though.
Unfortunately, using --force-foreground didn't help.
In my case, after looking through the Xcode build logs, I found this warning in the Bundle React Native code and images step:
Warning: build produced no sourcemaps.
It seems to be coming from this line in Sentry CLI.
I'm not very good at Rust, but hopefully this might help someone debug the issue.
Hi @darrylyoung, I'm wondering if you found out what causes the URL pointing to the device path instead of the uploaded artifact. I'm not using Expo but having the same issue.
Hi, @leonskim. No, unfortunately not. Have you tried the --force-foreground suggestion mentioned above?
@darrylyoung Still the same. Didn't work with --force-foreground option unfortunately.
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.2currently.
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",