-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🐛 [firebase_messaging] An unknown error occurred while calling method Messaging#getToken #10656
Comments
I'm seeing the same exception being throw by getToken, also firebase_messaging ^14.3.0 (firebase_core: ^2.8.0). For me, it happens with both debug and release builds. And it seems to only happen the first time getToken is called after initially installing the app. Subsequent calls to it (such as quitting and then restarting the app) seem to always succeed. Once a token is obtained, if the app deletes the token and then calls getToken again, it succeeds; i..e, truly only seeing it fail on the first getToken attempt after an initial install. If I go back to an earlier branch of our app's code, that was using firebase_messaging ^14.2.5 (firebase_core: ^2.7.0) then all is OK. flutter doctor...
flutter pub deps -- --style=compact...
|
Thanks for the explanation @jpears1 i can reproduce now by uninstalling the app using It's working fine indeed using |
Well as mentioned in my comment above, this is working fine using |
I found out this morning that some messages are being logged that I didn't mention last week because at the the time, my log was filtering out messages not logged directly by my app and I was unaware of that. When my app calls getToken, the following is being logged by FirebaseMessaging...
I looked through #10291, mentioned above darshankawar, and can't say it's the exact same problem, but after reading through it and especially other issues linked to it, it all seems likely related. #10679 is interesting and talks about changes recently made where an APNS token now needs to be obtained first and then handed off to Firebase before getToken can be called. No guidance on how that would be done with flutter, or if we should have to worry about it versus it should automatically be dealt with (as I would think) by I've been able to verify this is all tied to firebase_core 2.8.0 and firebase_messaging 14.3.0. I can consistently reproduce the problem using these versions. If I use previous versions of 2.71 and 14.2.6, I can't reproduce the problem. I also can make the issue go away by adding an I'm not into adding arbitrary 'sleeps' into our code so, for the moment, I'm changing the pubspec.yaml to revert back to firebase_core 2.7.1 and firebase_messaging 14.2.6. |
Thanks for the feedback and details. /cc @Lyokone |
I've tried same version as you mentioned core and messaging, but issue still happens. Is there any solutions? |
I have same issue with firebase_core 2.10.0 and firebase_messaging 14.4.1 Only in release build when call |
I'm facing same issue in release and profile modes with firebase_core 2.13.0 and firebase_messaging 14.6.1 I also see this in console logs when the app starts: |
same issue with firebase_messaging: ^14.6.0 and firebase_core: ^2.12.0 |
Hei! I have same issue. Did you find any solution for this? |
Im having the same issue when i request the notification token
|
Same problem with firebase_messaging: ^14.6.1 and firebase_core: ^2.13.0. It was resolved by adding the 'await' keyword to the code before loading the token. |
same issue if anyone find solution please mention it |
I have the same issue but not getting it every time, the frequency is 1 out of 6 to 7 tries. |
I solve this issue by reading fluter cloud configuration
…On Wed, 24 May 2023, 4:04 pm Nayan, ***@***.***> wrote:
I have the same issue but not getting it every time, the frequency is 1
out of 6 to 7 tries.
—
Reply to this email directly, view it on GitHub
<#10656 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQUBZ2L7D3ZSQIG2VBTN4DLXHXTMJANCNFSM6AAAAAAWG5LRUA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@nomi091 What do you mean by flutter cloud configuration? can you explain in brief? |
Yeah i have solve it let me send you details
1. Go to firebase.flutter.dev
2. go to app integration
3. Open project in xcode
4. after adding firebase notification and background modes
5. go to your project
6. Go to info plist add cfbundlesurltypes
Reverse client id
After adding close your project and open again run flutter clean problem
will solve won't show in frequency 1to 10
…On Wed, 24 May 2023, 5:29 pm Nayan, ***@***.***> wrote:
@nomi091 <https://github.com/nomi091> What do you mean by flutter cloud
configuration? can you explain in brief?
—
Reply to this email directly, view it on GitHub
<#10656 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQUBZ2OI2AHG3N6K4MEWU7LXHX5MNANCNFSM6AAAAAAWG5LRUA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This works for me, i downgraded the plugins to firebase_core: ^2.7.1 , firebase_messaging: ^14.1.0, repaired caches and run in release mode on my phone from android studio. It's not working with with firebase_messaging 14.6.2 , firebase_core 2.13.1 But i'm sure this is not the permanent fixed. |
I can confirm this is still an issue with firebase_messaging 14.4.1 and firebase_core 2.10.0. The fix that worked for me was calling |
Along with Do we have a timeline on when it will be fixed? |
I have faced same issue. My mistake was I called getToken before permission request. Change order and error fixed. Make sure has permission request completed and accepted before retrive token. |
facing the exact same issue. Getting the error only on testflight. Both debug and release modes work fine if installed from my machine. |
Thanks a lot for all your reports, I'm going to have a look at this issue. |
It seems related to the native SDK, I've opened an issue there: firebase/firebase-ios-sdk#11459 |
I have the same issue. I may have found a workaround. firebase_core: 2.7.1
firebase_messaging: 14.2.6
firebase_core_platform_interface: 4.5.3
|
I am also running into this problem. It consistently happens on first load on a real device, then goes away on second load (and thereafter). It's not a problem in the Simulator. |
Hello I am facing the same problem, I would like to know if anyone has got a solution?Please |
I had the same issue after the dependencies upgrade
I had not only Firebase but also another notifications library that needed to override this method in AppDelegate.swift
After adding this line to the end of the method, the problem disappeared |
It's not working on my app, |
@darshankawar any update on this ? |
I had the same issue on android device.
|
Using old version of firebase fixes things for me:
And in IOS/podfile
Updating pod file is not necessary, this is just me taking precaution and speed up build times for iOS by downloading the pre-compiled Firestore framework |
Any updates on this? @darshankawar @Lyokone. |
Logs.
|
I managed to resolve it by calling notification permission request from https://pub.dev/packages/permission_handler before requesting the token: import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:permission_handler/permission_handler.dart';
...
Future<void> setupPushNotification() async {
await [
Permission.notification,
].request(); // from permission_handler
NotificationSettings settings = await FirebaseMessaging.instance.requestPermission(
alert: true,
badge: true,
provisional: false,
sound: true,
); // request one more time
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
FirebaseMessaging.instance.getToken().then((value) {
print(value);
});
}
} |
@pupubird are you calling it before |
i'm facing same issue and stuck in white screen import UIKit @UIApplicationMain in the beginning i was using these then downgraded firebase_core: ^2.7.1 still same error [FirebaseMessaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '461658105137'.Be sure to re-retrieve the FCM token once the APNS device token is set. |
I got error when calling this
|
Bug report
Describe the bug
It's the same as #9878 but happening in release mode only in my TestFlight iOS app.
I do see many
Crashlytics
reports regarding this issue while in debug mode during development everything is fine, even if i build in release / profile mode and test it myself.This is happening with
firebase_messaging: ^14.3.0
:I am calling
String token = await FirebaseMessaging.instance.getToken() ?? "";
this way right after :Steps to reproduce
Even with #9878 steps i can't reproduce it anymore but it happens to my users from TestFlight (iOS only)
Expected behavior
Either this error not happening or seeing at least another message than
[FlutterError - [firebase_messaging/unknown] An unknown error has occurred.]
because when we look at the trace, this is coming from inside the plugin method so i don't know how can i fix it or even if i can fix it myself :/Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: