Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] 🔥 subscribeToTopic function call hanging indefinitely on Android #7997

Open
4 tasks
eirikhanasand opened this issue Aug 30, 2024 · 9 comments
Open
4 tasks
Labels
blocked: customer-response platform: android plugin: messaging FCM only - ( messaging() ) - do not use for Notifications type: question

Comments

@eirikhanasand
Copy link

eirikhanasand commented Aug 30, 2024

subscribeToTopic hanging indefinitely on Android

Description

When using the messaging().subscribeToTopic(topic) function on Android, the function hangs indefinitely, despite putting the function in a trycatch block. Ive verified that the application has INTERNET, NOTIFICATIONS and PUSH_NOTIFICATIONS permissions, and verified that the devices in question have access to internet and that the phone settings allows notifications. Furthermore Ive verified that the same exact code works on iOS, and that notifications are successfully delivered to the topic there. Ive also checked that the google-services.json file is valid, and redownloaded it from firebase in case I was doing something weird. The hanging issue makes it impossible to debug or handle in any way, as Ive tried everything I can think of, and the error is still there, without any useful feedback.

Relevant code

Here I am importing messaging, and using the subscribeToTopic() to subscribe to a topic (Ive verified that the topic is typeof string, and that it does not contain any special topics. Ive tested with topics 'test', or 'maintenance', both of which worked on iOS, and both of which hung indefinitely on Android.

import messaging from "@react-native-firebase/messaging"

/**
 * Subscribes the user to the passed topic
 * @param topic topic to subscribe to
 */
export default async function subscribeToTopic(topic: string) {
    console.log('subscribeToTopic', topic)
    try {
        console.log('subscribeToTopic tryeriaad')
        const subscribeWithTimeout = async (promise: any, timeout = 5000) => {
            let timeoutHandle: any;
            const timeoutPromise = new Promise((_, reject) => {
                timeoutHandle = setTimeout(() => reject(new Error('Timeout exceeded')), timeout);
            });
            return Promise.race([promise, timeoutPromise]).finally(() => clearTimeout(timeoutHandle));
        };
        
        console.log('Before subscribe 3', topic, typeof topic);
        const result2 = await messaging().subscribeToTopic(topic);
        // const result = await subscribeWithTimeout(messaging().subscribeToTopic(topic));
        // console.log('After subscribe 1', result);

        console.log('Before subscribe 2');
        console.log('After subscribe 2', result2);
        console.log('got result?')
        console.log('awaiting messaging result')
        return { result: true, feedback: `Subscribed to ${topic}`}
    } catch (e: any) {
        console.log('subscribeToTopic catch')
        if (e.message.includes('TOO_MANY_SUBSCRIBERS')) {
            return { result: false, feedback: `Too many subscribers for topic: ${topic}`}
        } else {
            return { result: false, feedback: `Subscription to topic failed: ${e}`}
        }
    }
}

Project Files

iOS: Podfile contents:
Not relevant, Android only issue.

Android: android/build.gradle contents.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'

        ndkVersion = "25.1.8937393"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.3'
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
    }
}

apply plugin: "com.facebook.react.rootproject"

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

Android: android/app/build.gradle contents:

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()

/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
    entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
    reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
    hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
    codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()

    // Use Expo CLI to bundle the app, this ensures the Metro config
    // works correctly with Expo projects.
    cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
    bundleCommand = "export:embed"

    /* Folders */
    //   The root of your project, i.e. where "package.json" lives. Default is '..'
    // root = file("../")
    //   The folder where the react-native NPM package is. Default is ../node_modules/react-native
    // reactNativeDir = file("../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
    // codegenDir = file("../node_modules/@react-native/codegen")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]

    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]
}

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * 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:+'

android {
    ndkVersion rootProject.ext.ndkVersion

    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace 'com.login.Login'
    defaultConfig {
        applicationId 'com.login.Login'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 69
        versionName "2.1.4"

        buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    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.debug
            shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    packagingOptions {
        jniLibs {
            useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
        }
    }
}

// Apply static values from `gradle.properties` to the `android.packagingOptions`
// Accepts values in comma delimited lists, example:
// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
    // Split option: 'foo,bar' -> ['foo', 'bar']
    def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
    // Trim all elements in place.
    for (i in 0..<options.size()) options[i] = options[i].trim();
    // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
    options -= ""

    if (options.length > 0) {
        println "android.packagingOptions.$prop += $options ($options.length)"
        // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
        options.each {
            android.packagingOptions[prop] += it
        }
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";

    if (isGifEnabled) {
        // For animated gif support
        implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
    }

    if (isWebpEnabled) {
        // For webp support
        implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
        if (isWebpAnimatedEnabled) {
            // Animated webp support
            implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
        }
    }

    implementation("com.facebook.react:flipper-integration")

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

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)

apply plugin: 'com.google.gms.google-services'
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.NOTIFICATIONS"/>
  <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
  <uses-permission android:name="android.permission.READ_CALENDAR"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.WRITE_CALENDAR"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.BROWSABLE"/>
      <data android:scheme="https"/>
    </intent>
  </queries>
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
    <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
    <meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/952a1914-0c53-43e7-b64e-8daab0b3a435"/>
    <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustPan" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="com.login.Login"/>
      </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
  </application>
</manifest>

Javascript

Click To Expand

package.json:

{
  "name": "login",
  "version": "2.1.3",
  "private": true,
  "main": "index.ts",
  "scripts": {
    "eas-build-pre-install": "./decodeSecrets.sh",
    "start": "react-native start",
    "cstart": "npx react-native start --reset-cache",
    "estart": "expo start --dev-client",
    "prebuild": "expo prebuild",
    "ios": "react-native run-ios",
    "eios": "expo run:ios",
    "android": "react-native run-android",
    "eandroid": "expo run:android",
    "build": "eas build -p all --auto-submit",
    "buildi": "eas build -p ios --local",
    "builda": "eas build -p android --local",
    "test": "jest"
  },
  "dependencies": {
    "@expo/config-plugins": "^7.8.4",
    "@react-native-async-storage/async-storage": "1.21.0",
    "@react-native-clipboard/clipboard": "^1.14.1",
    "@react-native-firebase/app": "^18.8.0",
    "@react-native-firebase/messaging": "^18.9.0",
    "@react-navigation/bottom-tabs": "^6.6.1",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.11.0",
    "@react-navigation/stack": "^6.4.1",
    "@reduxjs/toolkit": "^2.2.7",
    "expo": "~50.0.20",
    "expo-application": "~5.8.4",
    "expo-blur": "~12.9.2",
    "expo-build-properties": "^0.11.1",
    "expo-calendar": "^12.2.1",
    "expo-device": "~5.9.4",
    "expo-image-picker": "^14.7.1",
    "expo-linear-gradient": "~12.7.2",
    "expo-linking": "~6.2.2",
    "expo-splash-screen": "^0.26.5",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "~2.9.4",
    "expo-web-browser": "~12.8.2",
    "react": "^18.2.0",
    "react-native": "0.73.6",
    "react-native-base64": "^0.2.1",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-markdown-display": "^7.0.2",
    "react-native-reanimated": "~3.6.2",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-svg": "14.1.0",
    "react-redux": "^9.1.2",
    "redux": "^5.0.1",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^3.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@types/react": "~18.2.14",
    "@types/react-native-base64": "^0.2.2",
    "@types/react-test-renderer": "^18.3.0",
    "babel-jest": "^29.7.0",
    "babel-plugin-inline-import": "^3.0.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "jest": "^29.7.0",
    "jest-transform-stub": "^2.0.0",
    "react-native-svg-transformer": "^1.5.0",
    "react-test-renderer": "18.2.0",
    "ts-jest": "^29.2.5",
    "typescript": "^5.5.4"
  },
  "engines": {
    "node": ">=20"
  }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Android only issue.

Android

Click To Expand

Have you converted to AndroidX?

No


Environment

Click To Expand

react-native info output:

eirikhanasand@Eiriks-Macbook-Pro login_app % npx react-native info
info Fetching system and libraries information...
(node:16128) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
System:
  OS: macOS 14.3.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 509.19 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.7.0
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.8.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/eirikhanasand/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.3 AI-213.7172.25.2113.9123335
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.6
    path: /usr/bin/javac
  Ruby:
    version: 3.0.2
    path: /Users/eirikhanasand/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: ^18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.75.2 is now available (your project is running on v0.73.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.75.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.75.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
  • 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:
    18.9.0

  • Firebase module(s) you're using that has the issue:

    • e.g. Instance ID
  • Are you using TypeScript?
    Y, 5.5.4

@eirikhanasand eirikhanasand changed the title [🐛] Bug Report Title - 🔥 subscribeToTopic function call hanging indefinitely on Android [🐛] 🔥 subscribeToTopic function call hanging indefinitely on Android Aug 30, 2024
@eirikhanasand
Copy link
Author

Is it possible to give this issue increased priority? This is currently causing all our Android users to not recieve notifications in production, and we are unable to debug the problem, as the hanging doesnt leave any trace, logs or probable cause behind.

@russellwheatley
Copy link
Member

@eirikhanasand - I've just tried this and had no issue subscribing to topic on android and receiving message via topic. Worth stripping out all app code to something like this:

import React from 'react';
import { AppRegistry, Button, Text, View } from 'react-native';

import firebase from '@react-native-firebase/app';
import messaging from '@react-native-firebase/messaging';

firebase.messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background!', remoteMessage);
});
firebase.messaging().onMessage(message => {
  console.log('on message log');
});

function App(props) {
  return (
    <View>
      <Text>text text text</Text>
      <Text>text text text</Text>
      <Text>text text text</Text>
      <Button
        title="subscribe to topic"
        onPress={async () => {
          try {
            await firebase.messaging().subscribeToTopic('test');
            console.log('subscribed');
          } catch (e) {
            console.log(e);
          }
        }}
      />
      <Button
        title="get token"
        onPress={async () => {
          try {
            const token = await messaging().getToken();
            console.log('token', token);
          } catch (e) {
            console.log(e);
          }
        }}
      />
    </View>
  );
}

AppRegistry.registerComponent('testing', () => App);

Might be worth building app via android studio and seeing what happens as I'm not sure what is causing it to hang.

@russellwheatley russellwheatley added plugin: messaging FCM only - ( messaging() ) - do not use for Notifications blocked: customer-response type: question platform: android and removed Needs Attention type: bug New bug report labels Sep 2, 2024
@eirikhanasand
Copy link
Author

eirikhanasand commented Sep 3, 2024

Thanks for the quick reply. Ive tested more with your code, but unfortunately I am still consistently encountering the indefinite hanging issue with your code. Ive began work on a minimal reproducible repository to demonstrate the issue. However, I was unable to complete it today due to an unrelated iOS issue that blocked me from testing the minrep on iOS first to ensure the problem was the same. An update will follow tomorrow, hopefully with the minrep complete.

@eirikhanasand
Copy link
Author

After further research Ive been able to complete the minrep and discover the root cause of this issue. Ive been consistently able to reproduce the issue today, but during testing I discovered a vulnerability in the GCC API. I will share the cause and steps to reproduce after Ive shared the findings with Google.

Copy link

github-actions bot commented Oct 7, 2024

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale label Oct 7, 2024
@eirikhanasand
Copy link
Author

This issue occurs if you accidentally whitelist the wrong fingerprint in the cloud console.
Minimal reproducible: https://github.com/eirikhanasand/subscribetotopic-min-rep

However the minrep in itself isnt really that relevant since u can replicate it in any repo by just whitelisting an incorrect fingerprint.

@xerdnu
Copy link

xerdnu commented Oct 12, 2024

I also have this problem. Seems to happen when closing the network connection by minimizing the app for example. I have to restart the app completely to make the subscribe work again. I found i xcode logs that it hangs after this error message occurs.

10.29.0 - [FirebaseMessaging][I-FCM004001] Failed to subscribe to topic Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=57, NSUnderlyingError=0x3034b5050 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x301abb700 [0x1f2bebc70]>{length = 16, capacity = 16, bytes = 0x100201bb8efa4a2a0000000000000000}, _kCFStreamErrorCodeKey=57, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <E95291D7-E07D-4C1C-A2EE-55E226AAC350>.<71>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <E95291D7-E07D-4C1C-A2EE-55E226AAC350>.<71>",
    "LocalDataTask <A121CC79-22D1-4377-A3D8-EFC6F1C774C7>.<86>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://iid.googleapis.com/iid/register, NSErrorFailingURLKey=https://iid.googleapis.com/iid/register, _kCFStreamErrorDomainKey=1}

@eirikhanasand
Copy link
Author

eirikhanasand commented Oct 13, 2024 via email

@russellwheatley
Copy link
Member

This issue occurs if you accidentally whitelist the wrong fingerprint in the cloud console. Minimal reproducible: eirikhanasand/subscribetotopic-min-rep

However the minrep in itself isnt really that relevant since u can replicate it in any repo by just whitelisting an incorrect fingerprint.

Yes, the reproduction is doing the same as my code snippet effectively. This seems more of a bug upstream. I suggest opening a ticket with Firebase support and find out why subscribeToTopic() hangs with the above mentioned misconfiguration. Seems like it should throw an exception perhaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response platform: android plugin: messaging FCM only - ( messaging() ) - do not use for Notifications type: question
Projects
None yet
Development

No branches or pull requests

3 participants