Sentry-react-native: Bundle file and sourcemap don't get to be uploaded on Sentry through gradle

Created on 9 Apr 2021  Â·  9Comments  Â·  Source: getsentry/sentry-react-native

Environment

How do you use Sentry?

  • sentry.io

Which SDK and version?

  • react-native 0.63.4
  • @sentry/react-native 2.4.0
  • sentry-cli 1.63.2
  • fastlane-plugin-sentry 1.8.1

Steps to Reproduce

I set up sentry for react-native following the instructions from the website. In short I have the following:

settings.gradle

include ':@sentry_react-native'
project(':@sentry_react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@sentry/react-native/android')

build.gradle

project.ext.sentryCli = [
  logLevel: "debug"
]

...

if (project.env.get("SENTRY_ORG") != "") {
  apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
}

...

implementation project(':@sentry_react-native')

android/sentry.properties

defaults.url=https://sentry.io/
defaults.org=
defaults.project=
auth.token=

I'm using fastlane on my computer to build and release new app updates. I use the following:

    bump_version(type: options[:type])
    version = android_get_version_name
    build = android_get_version_code

    gradle(task: "clean")

    # I tried the assemble task (that generates APK) but it does the same
    gradle(
      task: "bundle",
      build_type: "Release",
      print_command: false
    )

Out of it, I have the following files generated. I believe been triggered by sentry gradle

[07:19:18]: â–¸ > Task :app:bundleReleaseJsAndAssets
[07:19:18]: â–¸ warning: the transform cache was reset.
[07:19:18]: â–¸ Welcome to React Native!
[07:19:18]: â–¸ Learn once, write anywhere
[07:19:44]: â–¸ info Writing bundle output to:, /path/app/build/generated/assets/react/release/index.android.bundle
[07:19:44]: â–¸ info Writing sourcemap output to:, /path/index.map
[07:19:44]: â–¸ info Done writing bundle output
[07:19:44]: â–¸ info Done writing sourcemap output
[07:19:45]: â–¸ info Copying 250 asset files
[07:19:46]: â–¸ info Done copying assets
[07:19:46]: â–¸ > Task :app:mergeReleaseShaders
[07:19:46]: â–¸ > Task :app:compileReleaseShaders NO-SOURCE
[07:19:46]: â–¸ > Task :app:generateReleaseAssets UP-TO-DATE

However, I don't get any app:bundleProductionReleaseJsAndAssets_SentryUpload following this step. I workaround using the fastlane sentry plugin to create a release and upload bundle and sourcemaps, but I imagine it would work out of the box using the sentry gradle

Expected Result

Bundle file and sourcemap should be uploaded in the gradle step.

Actual Result

Bundle file and sourcemaps are not "automatically" uploaded.

gradle

Most helpful comment

@kamilogorek @marandaneto Thanks for the wild ride through Sentry repositories, it was fun!

@leonskim That was it! Do you remember why I did add this option? :D Probably some copy/paste from StackOverflow to change JVM configurations

All 9 comments

@marandaneto transferred it here, as the sentry-cli is not triggered at all, which makes me think that the issue lies somewhere earlier in the pipeline.

@kamilogorek this plugin isn't responsible for uploading source maps, so I'm transferring to react-native repo

@jennmueng transferring from sentry-cli by @kamilogorek to sentry-android-gradle-plugin and from sentry-android-gradle-plugin to sentry-react-native :D

@jeremybarbet I'm wondering if you enabled org.gradle.configureondemand in gradle.properties. It should be false or commented out.

@jeremybarbet I'm assuming you are certain that SENTRY_ORG is defined and project.env.get("SENTRY_ORG") != "" is returning as true and the gradle script is getting applied right?

@kamilogorek @marandaneto Thanks for the wild ride through Sentry repositories, it was fun!

@leonskim That was it! Do you remember why I did add this option? :D Probably some copy/paste from StackOverflow to change JVM configurations

@jeremybarbet its in our docs btw :) https://docs.sentry.io/platforms/react-native/#android-specifics

@marandaneto I went over this page a couple of times but didn't pay attention to this, unfortunately. Maybe a warning hint kind-of-style would be more visible. Thanks all for the help :)

i have same problem on this issue ?is this cloed?

Was this page helpful?
0 / 5 - 0 ratings