react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary

Open mrenann opened this issue 1 year ago • 4 comments

LIBS: react-native-code-push": "^9.0.0 react-native": "0.75.4

I have two flavors

         flavorDimensions "default"
         productFlavors {
             development {
                 dimension "default"
                 applicationIdSuffix ".development"
                 resValue "string", "variant", "development"
                 resValue "string", "CodePushDeploymentKey", "MYSTAGINGKEY"
                 buildConfigField "String", "ENVFILE", "\".env.development\""
             }
             production {
                 dimension "default"
                 applicationIdSuffix ""
                 resValue "string", "variant", "production"
                 resValue "string", "CodePushDeploymentKey", "MYPRODKEY"
                 buildConfigField "String", "ENVFILE", "\".env.production\""
             }

         }

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")
    implementation project(':react-native-config')
    implementation ("com.facebook.fresco:fresco:3.2.0")
    implementation("com.facebook.fresco:animated-gif:3.2.0")
    implementation project(':react-native-code-push')

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

project.ext.envConfigFiles = [
    developmentDebug: ".env.development",
    developmentRelease: ".env.development",
    productionDebug: ".env.production",
    productionRelease: ".env.production"
]

project.ext.react = [
  entryFile: "index.js",
  enableHermes: true,
  hermesFlagsRelease: ["-O", "-output-source-map"]  // Optimize Hermes bytecode
]

And have activacted new Arch and using Hermes

LOGS:

com.microsoft.codepush.react.CodePushInvalidUpdateException: Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.
at com.microsoft.codepush.react.CodePushUpdateManager.downloadPackage(CodePushUpdateManager.java:255)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:298)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:292)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
2024-10-09 14:12:10.865 25133-27011 ReactNativeJS           usap64                               I  [CodePush] Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.```

mrenann avatar Oct 09 '24 18:10 mrenann

class MainApplication : Application(), ReactApplication {

  override val reactNativeHost: ReactNativeHost =
      object : DefaultReactNativeHost(this) {
        override fun getPackages(): List<ReactPackage> =
            PackageList(this).packages.apply {
              // Packages that cannot be autolinked yet can be added manually here, for example:
              // add(MyReactNativePackage())
            }

          override fun getJSBundleFile(): String {
              return CodePush.getJSBundleFile()
          }

        override fun getJSMainModuleName(): String = "index"

        override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

        override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
        override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
      }

  override val reactHost: ReactHost
    get() = getDefaultReactHost(applicationContext, reactNativeHost)

  override fun onCreate() {
    super.onCreate()
    Fresco.initialize(this)
    SoLoader.init(this, false)
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
      // If you opted-in for the New Architecture, we load the native entry point for this app.
      load()
    }
  }
}

mrenann avatar Oct 09 '24 18:10 mrenann

Hello @mrenann thank you for reaching out! I see you are using new arch you could try this workaround https://github.com/microsoft/react-native-code-push/issues/2083#issuecomment-1411745157 and see if it works for you. If not i suggest not use new arch as we don't support it, i belive you can still opt out from it.

DordeDimitrijev avatar Oct 11 '24 10:10 DordeDimitrijev

Hello :) Thanks for the help I looked, but I didn't quite understand where I should put it, I'll try to send a message there to understand

mrenann avatar Oct 11 '24 19:10 mrenann

I understand, but you can always disable new arch since as i said this is a workaround and we don't plan on supporting new arch for react-native-code-push.

DordeDimitrijev avatar Oct 14 '24 09:10 DordeDimitrijev

Closing due inactivity.

DordeDimitrijev avatar Oct 28 '24 12:10 DordeDimitrijev