bugsnag / bugsnag-android-gradle-plugin

Gradle plugin for BugSnag which uploads ProGuard, DexGuard and NDK mapping files, and sends build notifications
https://docs.bugsnag.com/build-integrations/gradle/
MIT License
70 stars 38 forks source link

ReactNative 0.71.1 - SourceMap not uploaded #492

Closed Elvinra closed 1 year ago

Elvinra commented 1 year ago

Describe the bug

When i'm trying to build on release mode my RN project, i can see on my output window some error from bugsnag, and the sourcemap wasn't uploaded on the Dashboard.

Bugsnag: unable to find ReactNative bundle task 'bundleDevReleaseJsAndAssets'

After some research, i found out gradle task was renamed from 'bundleDevReleaseJsAndAssets' to 'createBundleDevReleaseJsAndAssets'.

As we can see on the github of ReactNative : https://github.com/facebook/react-native/blob/cd5a8c48c59a0ecac21b19787ed8951dc23f57bb/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L55

This changement was made for the 0.71.+ before that the name of the Gradle task is correct.

They are other changement made to this version The file index.android.bundle.map is still located to the same directory : android/app/build/generated/sourcemaps/react/release

But the file index.android.bundle was move on an another folder Before: android/app/build/generated/assets/react/release After : android/app/build/ASSETS/createBundleReleaseJsAndAssets/

Steps to reproduce : 0.70.6

  1. npx react-native init test --version 0.70.6
  2. cd test/android
  3. ./gradlew task | grep JsAnd Output
    bundleDebugJsAndAssets - bundle JS and assets for Debug.
    bundleReleaseJsAndAssets - bundle JS and assets for Release.

Steps to reproduce : 0.71.1

  1. npx react-native init test
  2. cd test/android
  3. ./gradlew task | grep JsAnd Output
    createBundleReleaseJsAndAssets

Environment

mclack commented 1 year ago

Hi @Elvinra,

Thanks for bringing this to our attention. We’ve identified an issue that we believe to be causing this and our engineers will work on a fix for this soon. We will make sure to keep you updated with the progress!

Rag0n commented 1 year ago

Hey @mclack, do you have any update? RN 0.71 was released more than month ago

johnkiely1 commented 1 year ago

Hi @Rag0n,

After some additional investigation it appears the structure of the ReactNative bundle task has changed completely, and will require significant work to our plugin in order to support both the old and new structures.

While we work on this, we would advise to invoke our JS bugsnag-source-maps upload-react-native CLI tool manually https://docs.bugsnag.com/build-integrations/js/source-maps-react-native/

We will post here as soon as we have further updates.

ruslan-hontar commented 1 year ago

@johnkiely1 any news regarding this?

johnkiely1 commented 1 year ago

Hi @ruslan-hontar. No updates I'm afraid, this is still on the backlog and other priorities have meant we haven't been able to work on it as yet. We will update as soon as we have anything to share.

timhooker commented 1 year ago

Chiming in here to say this issue is pretty pressing for our team. The past few releases have unusable errors in them. We would love to see a fix become a priority.

tomlongridge commented 1 year ago

Just to keep you updated, we have now released a new version of the BugSnag CLI to help plug this gap. Rather than hooking into your Gradle build itself, this solution runs after the build to upload the source maps.

For now this will require some manual integration, however you can expect some updates in due course that will reduce the setup steps somewhat.

For information, please see our docs: https://docs.bugsnag.com/platforms/react-native/react-native/rn071/

timhooker commented 1 year ago

Thanks @tomlongridge we had stumbled onto that by chance. This may be the wrong forum for this but what's the difference between that the cli you referenced and @bugsnag/react-native-cli on npm?

tomlongridge commented 1 year ago

The aim of the BugSnag CLI is to provide a generic solution for uploading build artefacts across all our platforms – the idea is that is highly configurable so that it can suit almost any build system.

We are aiming to have our associated build tools use the CLI where appropriate. In fact, in the case of @bugsnag/react-native-cli we are actively developing an update to have it download the CLI binary and expose it for use within NPM scripts.

tomlongridge commented 1 year ago

For new projects, our @bugsnag/react-native-cli is now compatible with RN 0.71 and 0.72 directory structures - it uses the BugSnag CLI to perform the uploads outside of Gradle (and the bugsnag-android-gradle-plugin) so that we're not tied to changes going on in the Gradle build that seem to be going on in the React Native tooling.

The bugsnag-android-gradle-plugin should now only be used to upload native Android files (ProGuard mappings and SO files) and the BugSnag CLI (now with an NPM wrapper) used for Android source map uploads. Users can remove/disable the uploadReactNativeMappings configuration option in bugsnag-android-gradle-plugin.

We have also updated our docs page to give a run down of what people upgrading to RN 0.71+ and their BugSnag integration need to do: https://docs.bugsnag.com/platforms/react-native/react-native/showing-full-stacktraces/

In future iterations, we aim to also support the Cocoa platforms in the CLI and so consolidate the instructions further.