firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
357 stars 129 forks source link

Legacy API Deprecation for FCM #349

Open euantorano opened 1 year ago

euantorano commented 1 year ago

We've received an email yesterday regarding deprecation of the legacy API for FCM. It links to an FAQ entry, which says to migrate usages of SendMulticastAsync to SendEachForMulticastAsync.

I see this method was added in commit 74bd9e50, but there has not been a release tagged since 24/03/2022.

Is there any chance a new release might be tagged and pushed to NuGet at some point soon (preferably before the API cutoff on 20/06/2024...)?

google-oss-bot commented 1 year ago

I found a few problems with this issue:

euantorano commented 1 year ago

I note that this seems to affect every version of the Admin SDK, including:

In fact, the only version that seems OK is Node (functions implemented in https://github.com/firebase/firebase-admin-node/commit/0da72ef60535b6a9d0267e3843f45512718b8e74 and seemingly included in release 11.9.0)

fu-mybeepr commented 1 year ago

I was wondering the same. The FAQ page specifically says >= 2.4.0 for .Net, but apparently 2.4.0 is not released on either GitHub or Nuget.

tonsnoei commented 1 year ago

Additional to the above questions and important in relation to the performance of the library with this new (batch/multicast replacing) functionality:

I saw that in 2.4.0 the suggested usage of HTTP/2 for the HttpClient is not implemented yet. Right?

I am not sure how the HttpClient behaves. Does it automatically use HTTP/2 in some situations? From what I understand you have to set the handler of the HttpClient explicitly in the following way:

DefaultRequestVersion = new Version(2, 0); // Use HTTP/2

Just wondering...

Furthermore, keep up the good work!

ewfian commented 11 months ago

Additional to the above questions and important in relation to the performance of the library with this new (batch/multicast replacing) functionality:

I saw that in 2.4.0 the suggested usage of HTTP/2 for the HttpClient is not implemented yet. Right?

I am not sure how the HttpClient behaves. Does it automatically use HTTP/2 in some situations? From what I understand you have to set the handler of the HttpClient explicitly in the following way:

DefaultRequestVersion = new Version(2, 0); // Use HTTP/2

Just wondering...

Furthermore, keep up the good work!

Same question here. From this doc, the default version is 1.1 on .NET 6

In .NET Core, the default message version differs based on the version you're using. .NET Core 2.1 changed the default value from 1.1 to 2.0. In .NET Core 3.0, the default value was reverted back to 1.1. https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestmessage.version?view=net-6.0#property-value

FirebaseAdmin supports netstandard2.0, while netstandard2.0 compatible with .NET Core 2.1 and 2.2 https://github.com/firebase/firebase-admin-dotnet/blob/bc7bc090a0636b4c7487dd530511139ec60b167a/FirebaseAdmin/FirebaseAdmin/FirebaseAdmin.csproj#L5C30-L5C30 https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0

According this comment, the default behavior will vary between different .net versions

The HTTP message version. The default value is 1.1, unless you're targeting .NET Core 2.1 or 2.2. In that case, the default value is 2.0.

euantorano commented 11 months ago

Now that 2.4.0 has been released, I've updated my project to it.

It looks like SendMulticastAsync hasn't been marked as obsolete/deprecated as the ObsoleteAttribute is commented out: https://github.com/firebase/firebase-admin-dotnet/blob/bc7bc090a0636b4c7487dd530511139ec60b167a/FirebaseAdmin/FirebaseAdmin/Messaging/FirebaseMessaging.cs#L422

It seems the attribute was added but commented out in https://github.com/firebase/firebase-admin-dotnet/commit/74bd9e5038aa49562a093fa72c80c252384e85c8 - this is fairly easy to miss as Visual Studio by default continues the block comment when you enter a new line at the end.

lahirumaramba commented 11 months ago

Hey folks, you are right there was a delay on the .NET release and the new batch send APIs are now available in v2.4.0 https://firebase.google.com/support/release-notes/admin/dotnet#version_240_-_12_july_2023

Thank you for flagging the issue with the Obsolete tag! @Doris-Ge could you take a look at the ObsoleteAttribute when you get a chance, please? Thanks!

Doris-Ge commented 11 months ago

Thank you for flagging the issue with the Obsolete tag! @Doris-Ge could you take a look at the ObsoleteAttribute when you get a chance, please? Thanks!

Sure. I think I misunderstood the usage of Obsolete.

Thanks for flagging the issue! Will fix it.

danports commented 11 months ago

I upgraded a project to v2.4.0 and replaced usages of SendMulticastAsync with SendEachForMulticastAsync and had to revert the upgrade a few days later because SendEachForMulticastAsync did not deliver notifications to devices as reliably as SendMulticastAsync - some notifications seemed to be lost. Has anyone else that upgraded ran into this? I haven't yet dug into where in the stack the notifications were being lost, and it's possible it was a fluke.

R4DIC4L commented 10 months ago

Is this related to the legacy Firebase Cloud Messaging (FCM) APIs which will be discontinued on June 20, 2024?

Does SendMulticastAsync use Batch send API?

On June 20, 2024, we’re reducing the number of Firebase Cloud Messaging (FCM) legacy register APIs and legacy send APIs that provide similar functionality. This step will allow us to provide you with a more consistent experience and align with Google security standards to improve security, reliability and performance.

Because of these API decommissions, some already-deprecated SDKs and features will stop working after June 20, 2024.

Please consult the tables below to find which Firebase Cloud Messaging (FCM) APIs and corresponding services/SDKs/features will be discontinued and replaced with new alternatives.

image

R4DIC4L commented 10 months ago

I upgraded a project to v2.4.0 and replaced usages of SendMulticastAsync with SendEachForMulticastAsync and had to revert the upgrade a few days later because SendEachForMulticastAsync did not deliver notifications to devices as reliably as SendMulticastAsync - some notifications seemed to be lost. Has anyone else that upgraded ran into this? I haven't yet dug into where in the stack the notifications were being lost, and it's possible it was a fluke.

I am now performing the same upgrade to v2.4.0, but need more time to test the new SendEachForMulticastAsync method for notifications. Any particular use case when this happens? Is it happening for a high volume of notifications?

Doris-Ge commented 10 months ago

Is this related to the legacy Firebase Cloud Messaging (FCM) APIs which will be discontinued on June 20, 2024? Does SendMulticastAsync use Batch send API?

Yes and yes.

hanselsen commented 7 months ago

Hi all. Since this issue is still open, I wish to inquire about the status of it.
Reading back in this thread, it should be fixed when people upgrade to 2.4.0?

For example, I am using SendAllAsync and SendAsync. Do I need to do anything else?

EricaLi123 commented 7 months ago

Hi all. Since this issue is still open, I wish to inquire about the status of it. Reading back in this thread, it should be fixed when people upgrade to 2.4.0?

For example, I am using SendAllAsync and SendAsync. Do I need to do anything else?

You just need to upgrade to 2.4.0 and replace SendAllAsync with SendEachAsync. https://firebase.google.com/support/release-notes/admin/dotnet#cloud-messaging

alex-radch commented 3 months ago

There are ~2 months left before the completion of firebase legacy methods, is there any news? Our company is waiting for a solution to this problem. Is there really only a manual way left for us, like presented above?

tonsnoei commented 3 months ago

There are ~2 months left before the completion of firebase legacy methods, is there any news? Our company is waiting for a solution to this problem. Is there really only a manual way left for us, like presented above?

As far as I know, just replace the SendAllAsync with SendEachAsync as @EricaLi123 mentioned. We did this with our company a few months ago. It works well.

Igouist commented 2 months ago

Is this related to the legacy Firebase Cloud Messaging (FCM) APIs which will be discontinued on June 20, 2024?這與將於 2024 年 6 月 20 日停用的舊版 Firebase Cloud Messaging (FCM) API 有關嗎? Does SendMulticastAsync use Batch send API?SendMulticastAsync 是否使用批量發送 API?

Yes and yes. 是的,是的。

I just want to confirm that we are currently using SendMulticastAsync .

Should we switch to SendEachForMulticastAsync by June 20th, or am I misunderstanding something?

Thank you QQ

tonsnoei commented 2 months ago

Is this related to the legacy Firebase Cloud Messaging (FCM) APIs which will be discontinued on June 20, 2024?這與將於 2024 年 6 月 20 日停用的舊版 Firebase Cloud Messaging (FCM) API 有關嗎? Does SendMulticastAsync use Batch send API?SendMulticastAsync 是否使用批量發送 API?

Yes and yes. 是的,是的。

I just want to confirm that we are currently using SendMulticastAsync .

Should we switch to SendEachForMulticastAsync by June 20th, or am I misunderstanding something?

Thank you QQ

Yes! Use SendEachForMulticastAsync now instead of SendMulticastAsync