-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Comments
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. |
@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. |
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. |
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. |
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?
Thank you for your contributions. |
This issue occurs if you accidentally whitelist the wrong fingerprint in the cloud console. However the minrep in itself isnt really that relevant since u can replicate it in any repo by just whitelisting an incorrect fingerprint. |
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.
|
This is not the same issue. The issue I have reported is Android only, and
minimizing the app does not affect it.
lør. 12. okt. 2024 kl. 19:10 skrev xerdnu ***@***.***>:
… 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}
—
Reply to this email directly, view it on GitHub
<#7997 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOFFPBTQWXSXXJ53LWY7ATTZ3FJZJAVCNFSM6AAAAABNLRJQ2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYGYZDSOBSHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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 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.
Project Files
iOS:
Podfile
contents:Not relevant, Android only issue.
Android:
android/build.gradle
contents.Android:
android/app/build.gradle
contents:Javascript
Click To Expand
package.json
: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:Platform that you're experiencing the issue on:
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
The text was updated successfully, but these errors were encountered: