Sentry-react-native: Execution failed for task ':app:bundleReleaseJsAndAssetsSentryUpload'.

Created on 15 May 2017  路  9Comments  路  Source: getsentry/sentry-react-native

When building an Android release with react-native-sentry version 0.8.4, I'm getting the following error when the build is trying to upload the sourcemap assets to Sentry:

error: An organization slug is required (provide with --org)

How can I provide the script with the necessary org information?

Most helpful comment

Hey, please upgrade to the latest version.
Make sure you run react-native unlink react-native-sentry react-native link react-native-sentry.

All 9 comments

option 1:
run command to export environments variables before build:
export SENTRY_URL=xxx && export SENTRY_ORG=xxx && export SENTRY_PROJECT=xxx && export SENTRY_AUTH_TOKEN=xxx && react-native run-android

option 2:
create file android/sentry.properties with these config

Thanks for the answer @minhtc exporting the env vars did the trick.

One follow-up question: We are using react-native-config to manage environment-specific variables (such as sentry config). It would be awesome if react-native-sentry could simply pick up those SENTRY_... values if I add them to my .env file.
This is what react-native-config is doing to make the variables from the .env files(s) available in gradle: https://github.com/luggit/react-native-config/blob/master/android/dotenv.gradle

(Would be even greater if this would work for both Android and iOS)

@jhilden sentry-cli should already pickup any .env files
Where is the .env located? In your react-native project root or in an android folder?

So, picking up the settings from .env file does work :+1:. However, it's not really ideal because we use the .env file for development and a different file .env.production for production. So, now I have to put those settings to upload the production sourcemaps into the "wrong" configuration file. Which env file to use is controlled by the variable ENVFILE (see https://github.com/luggit/react-native-config#different-environments), maybe sentry-cli could also use that?

I also tried putting the necessary variables into android/sentry.properties, but this was not picked up by the build script and I was getting the error: An organization slug is required (provide with --org) again. This was the content of that file:

# android/sentry.properties
SENTRY_ORG=myorg
SENTRY_PROJECT=myproject
SENTRY_AUTH_TOKEN=*****

(btw: I'm on react-native-sentry version 0.9.1 now)

Hey, please upgrade to the latest version.
Make sure you run react-native unlink react-native-sentry react-native link react-native-sentry.

@jhilden Did you find a solution for using the react-native-config environment variables with your sentry.properties file? I am also interested in working with that setup.

@jarredszabadi We just tried switching from the sentry-cli properties being stored in the .env file to them being loaded from android/sentry.properties, but it did not work. So we keep using the .env file for now.

react-native-sentry: 0.12.10
sentry-cli-binary: 1.13.3

i am facing this same issue with iOS. Can anyone suggest me how to handle it in iOS?

I had the same problem I solved naming the file sentry.properties :

edit "node_modules/react-native-sentry/sentry.gradle"
propertiesFile = "$reactRoot/android/sentry-${variant}.properties"
println propertiesFile ---> add

Shows me in console
/home/developer/workspace/ReactNativeApp/android/sentry-flavorRelease.properties
/home/developer/workspace/ReactNativeApp/android/sentry-flavorDebug.properties

This is working.

Was this page helpful?
0 / 5 - 0 ratings