Closed furofo closed 3 weeks ago
I found a few problems with this issue:
Any updates to this issue/bug @lahirumaramba? There is no way for us to fix this issue without changing the whole timezone settings for our computer/server and that will affect alot of other functionality.
Yes, only older version works..
2.2.0 works fine.
Yeah!
But what should be do about the deprecation of legacy FCM? SendAll is not usable after 21th of June 2024 and SendEach doesn't work cause of the bug in versions 2.3.0 and above?
I have solution for this issue,
before send switch CultureInfo.CurrentCulture to InvariantCulture and after this set back to normal CurrentCulture what you save to variable.
var oldCulture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
// your logic here e.g. await _messaging.SendAsync(..)...
CultureInfo.CurrentCulture = oldCulture;
now you can send notifications successfully.
@furofo Thanks for highlighting this issue
@TMariapori Will the temporary Culuture change affect the current thread or the whole api in the time that the messages are send ?
Note that this issue was foundallmost two years ago
THere is an open pull request which needs reviewers. https://github.com/firebase/firebase-admin-dotnet/pull/329
Yes, but this is solution if not wanna fork firebaseadmin. And yes only current thread.
This is correct fix for this bug, but need apply this to this nuget. https://github.com/firebase/firebase-admin-dotnet/pull/329
Thanks for your patience folks! This is covered in #417 now
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Issues with the following error message:
FirebaseAdmin.Messaging.FirebaseMessagingException: Invalid value at 'message.android.notification.event_time' (type.googleapis.com/google.protobuf.Timestamp), Field 'event_time', Invalid time format: Failed to parse input
It occurs when trying to use Firebase SDK 2.4.0 in .NET and sending an Android notification when you have your system time set to a format that is not U.S.-based, like Europe. Currently, if your time settings are set to a region with a different time format, like Europe, it sets
event_time
in a format like2024-02-26T07.00.58.787372000Z
instead of2024-02-26T07:00:58.787372000Z
, which is not in the ISO 8601 standard format.As a workaround, users can change their time settings to English, but this creates other problems. I believe I have narrowed down the issue to one line of code specifically.
In Version 2.3.0 of the SDK, a commit was made: "Closes #153. Add additional FCM options for Android Notification #203." This change, in particular, affected the
FirebaseAdmin/FirebaseAdmin/Messaging/AndroidNotification.cs
file. In this commit, the following code is problematic:In the setter method,
CultureInfo.InvariantCulture
is used, which employs a standard format for parsing theDateTime
but is not used in the getter, which is the source of the problem. This omission causesevent_time
to use the local time settings instead, leading to the incorrect format.This is a problem because all other versions of Firebase are being deprecated in July 2023. To fix this, the getter should include
CultureInfo.InvariantCulture
to ensure consistent formatting:Steps to reproduce:
Steps to reproduce: Set up Firebase in a .NET project. Make a message with an AndroidConfig object set up. Set computer settings to use the Finnish format for the Region. (In Windows, this can be done from Clock and Region in the Control Panel.) Set a breakpoint for the response and send the message with either FirebaseMessaging.DefaultInstance.SendEachAsync or FirebaseMessaging.DefaultInstance.SendAsync. Inspect the response in the debugger for the failure message.
Relevant Code:
Response Code set Breakpoint at return result