Skip to content

Invalid UTF-8 continuation byte for index.android.bundle #3272 #39359

@voortexx

Description

@voortexx

Bug Description

I have a weird problem. We update our react-native from 0.71.7 to O.72.3.
And an issue appeared only for Android.

We use fastlane to generate and upload our files to Sentry, but since this update the index.android.bundle.map is no longer created. I saw that instead we have index.android.bundle.packager.map and we should merge it with another file.

So I look at the documentation and add the script like that

def create_sentry_release(app_name:, flavor_type:)
  # Create sourcemaps folder at project root
  sh("cd ../.. && mkdir -p sourcemaps")
  # Copy the sourcemaps in the new folder
  flavor = flavor_type  == 'Store' ? app_name : "#{app_name}#{flavor_type}"
  asset_bundle_directory_name = flavor_type  == 'Store' ? "createBundle#{app_name.capitalize}ReleaseJsAndAssets"
                               : "createBundle#{app_name.capitalize}#{flavor_type.capitalize}ReleaseJsAndAssets"
  sh('npx react-native bundle --platform android --dev false --entry-file index.js --reset-cache --bundle-output index.android.bundle --sourcemap-output index.android.bundle.packager.map --minify false')
  sh("cp ../app/build/generated/assets/#{asset_bundle_directory_name}/index.android.bundle ../../sourcemaps")
  sh("../../node_modules/react-native/sdks/hermesc/osx-bin/hermesc -O -emit-binary -output-source-map -out=index.android.bundle.hbc ../../sourcemaps/index.android.bundle")
  sh("rm -f ../../sourcemaps/index.android.bundle")
  sh("mv ../../sourcemaps/index.android.bundle.hbc ../../sourcemaps/index.android.bundle")
  sh("cp ../app/build/intermediates/sourcemaps/react/#{flavor}Release/index.android.bundle.packager.map ../../sourcemaps")
  sourcemap_path="../sourcemaps"

But the hermes script that should generate the index.android.bundle.hbc file failed with this error
Capture d’écran 2023-09-08 à 17 48 25

In fact when I run file -I ../sourcemaps/index.android.bundle it output application/octet-stream; charset=binary

  • I have run gradle clean and confirmed this bug does not occur with JSC

Hermes version: Embedded in react native
React Native version (if any): 0.72.3
OS version (if any): Ventura & Linux CircleCI
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64):

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions