Closed VitoFromEarth closed 1 year ago
I went to the stacktrace
it led me here
Then here
It looks like we get a null from error.getString("sessionId")
and it leads to getNullableValue
error. But it's only an assumption
If we look at getJSError
then we see that we record sessionId
only in this case
This version is old enough I'm not sure it works:
"react-native": "0.63.3",
I imagine that could be the cause of the issue. react-native support is generally 2 prior versions https://github.com/reactwg/react-native-releases#releases-support-policy
ok. So as i understand the only option right now is to upgrade the RN platform
You could stay on outdated react-native and code around the problem some how (it is open source after all) However, given react-native 0.63 is about 3 years old now and does not even compile with Xcode 13 - which is a requirement for uploading new versions I think at this point? - delaying the upgrade does not appear to make sense.
And I believe the error will go away once you are on the current version. So, probably worth it.
Sure I understand that. Just wanted to know if there is a solution that could help fast while the migration is on the way. Thank you for help :)
@VitoFromEarth Is it resolved now? If so, then which version did you upgrade react-native to?
@VitoFromEarth Is it resolved now? If so, then which version did you upgrade react-native to?
Updated to latest RN version. But on older RN you can drop support for auto code insert and it also fixes the issue for some reason on older RN version
@Akshay-Niveus We ran into this issue on 0.63.3, and it turned out the root of the problem was the app's debug hash not being registered in the firebase console
I run into this problem also
I'm using:
"react": "16.9.0"
"react-native": "0.61.5"
"@react-native-firebase/app": "^18.3.0"
The error:
com.facebook.react.bridge.NoSuchKeyException: sessionId
Using logcat of adb it gave other error:
signInWithCustomToken: onComplete:failure
com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host) has occurred.
It led me here but still don't have any idea how to fix.
Issue
Used
firebase/auth v16.4.6
Replicates on Android only On Samsung/Oppo/Xiaomi devices we detect in sentry a lot of issues with next message:Project Files
Android
Click To Expand
#### Have you converted to AndroidX? - [x] my application is an AndroidX application? - [x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy buildscript { ext { minSdkVersion = 24 compileSdkVersion = 31 buildToolsVersion = "30.0.2" targetSdkVersion = 31 kotlinVersion = "1.4.10" ndkVersion = "24.0.8215888" } repositories { google() jcenter() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://artifactory.img.ly/artifactory/imgly" } configurations.all { resolutionStrategy { force "com.facebook.soloader:soloader:0.10.0" } } } dependencies { classpath('com.android.tools.build:gradle:4.1.0') classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10" classpath 'ly.img.android.sdk:plugin:9.0.0' classpath 'com.google.gms:google-services:4.3.15' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) allprojects { configurations.all { resolutionStrategy { // can be removed from RN version: 0.71.0 force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION } } repositories { exclusiveContent { filter { includeGroup "com.facebook.react" } forRepository { maven { url "$rootDir/../node_modules/react-native/android" } } } google() jcenter() mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } maven { url "https://www.jitpack.io" } maven { url "https://maven.google.com" } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" import com.android.build.OutputFile project.ext.envConfigFiles = [ localDebug: ".env.local", tstDebug: ".env.test", stagingDebug: ".env.staging", productionDebug:".env.production", tstRelease:".env.test", stagingRelease:".env.staging", productionRelease:".env.production", ] apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" project.ext.react = [ enableHermes: false, bundleInDebug: false, bundleInStaging: false, bundleInRelease: false, jsBundleDirDebug: "$buildDir/intermediates/assets/debug", resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", jsBundleDirTst: "$buildDir/intermediates/assets/tst", resourcesDirStaging: "$buildDir/intermediates/assets/tst", resourcesDirStaging: "$buildDir/intermediates/res/merged/staging", jsBundleDirRelease: "$buildDir/intermediates/assets/release", resourcesDirRelease: "$buildDir/intermediates/res/merged/release", devDisabledInDebug: false, devDisabledInStaging: true, devDisabledInTst: true, devDisabledInRelease: true, inputExcludes: [ "ios/**", "__tests__/**", "bundle_out/**", "amplify/**", "fastlane/**", "Firebase/**", "keys/**", "patches/**", "scripts/.." ], extraPackagerArgs: ["--verbose"] ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply plugin: 'ly.img.android.sdk' apply plugin: 'kotlin-android' apply from: "../../node_modules/@sentry/react-native/sentry.gradle" imglyConfig { modules { include 'ui:video-trim' } } /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc-intl:+' /** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false) /** * Defining build variables from ENV VARS */ android { // ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId appID // package name in manifest file is just to organize your code. The applicationId, on the other hand, is used to identify your app in the Play Store. minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion versionCode 1676047876 versionName "1.67" multiDexEnabled true missingDimensionStrategy 'react-native-camera', 'general' resValue "string", "build_config_package", //should be the same as in manifest } dexOptions { javaMaxHeapSize "4g" } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } release { if (System.getenv('ANDROID_KEYSTORE_FILE') != null) { storeFile file(System.getenv('ANDROID_KEYSTORE_FILE')) storePassword System.getenv('ANDROID_KEYSTORE_PASSWORD') keyAlias System.getenv('ANDROID_KEY_ALIAS') keyPassword System.getenv('ANDROID_PASSWORD') } } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } lintOptions { checkReleaseBuilds false abortOnError false } flavorDimensions "version" //All product flavors must belong to a named flavor dimension, which is a group of product flavors. You must assign all flavors to a flavor dimension; otherwise, you will get the build error. If a given module specifies only one flavor dimension, the Android Gradle plugin automatically assigns all of the module's flavors to that dimension. productFlavors { local { dimension "version" applicationId project.env.get("PRODUCT_BUNDLE_IDENTIFIER") } tst { dimension "version" applicationId project.env.get("PRODUCT_BUNDLE_IDENTIFIER") } staging { dimension "version" applicationId project.env.get("PRODUCT_BUNDLE_IDENTIFIER") } production { dimension "version" applicationId project.env.get("PRODUCT_BUNDLE_IDENTIFIER") } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://seloper.android.com/studio/build/configure-apk-splits.html def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation project(':react-native-config') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(':react-native-push-notification') implementation "com.facebook.react:react-native:+" // From node_modules implementation 'com.android.support:multidex:1.0.3' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation 'com.google.firebase:firebase-analytics:19.0.0' implementation 'com.facebook.soloader:soloader:0.10.0' debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/" debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services' apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'App' include ':@react-native-community_cameraroll' project(':@react-native-community_cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cameraroll/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':@react-native-community_blur' project(':@react-native-community_blur').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/blur/android') include ':react-native-orientation-handler' project(':react-native-orientation-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation-handler/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app', ':react-native-config' include ':react-native-push-notification' project(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android') ``` #### `MainApplication.java`: ```java package com.app; import android.content.Context; import androidx.multidex.MultiDex; import androidx.multidex.MultiDexApplication; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends MultiDexApplication implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class> aClass = Class.forName("com.app.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 13.2.1 CPU: (10) arm64 Apple M1 Max Memory: 360.70 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.1.0 - ~/.nvm/versions/node/v19.1.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v19.1.0/bin/yarn npm: 9.4.1 - ~/.nvm/versions/node/v19.1.0/bin/npm Watchman: 2023.01.30.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/vitaliykononenko/.rvm/gems/ruby-3.1.2/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found (PROBABLY BECAUSE I USE JetBains Toolbox) IDEs: Android Studio: Flamingo 2022.2.1 Beta 3 Flamingo 2022.2.1 Beta 3 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `16.4.6` - **`Firebase` module(s) you're using that has the issue:** - `Authentication` - **Are you using `TypeScript`?** - `Y` & `4.7.4`
React Native Firebase
andInvertase
on Twitter for updates on the library.