firebase-admin-dotnet icon indicating copy to clipboard operation
firebase-admin-dotnet copied to clipboard

Legacy API Deprecation for FCM

Open euantorano opened this issue 1 year ago • 23 comments

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...)?

euantorano avatar Jun 21 '23 09:06 euantorano

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jun 21 '23 09:06 google-oss-bot

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

  • .NET (this issue)
  • Go
  • Java (functions implemented in https://github.com/firebase/firebase-admin-java/commit/d1baee366cebf121aa6d5a62593c08cc26ce97a8 but no release tagged)
  • Python (functions implemented in https://github.com/firebase/firebase-admin-python/commit/4323ed88cef168d66844add3aeaf3b7d19b46be6 but no release tagged)

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)

euantorano avatar Jun 21 '23 09:06 euantorano

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.

fu-mybeepr avatar Jun 22 '23 01:06 fu-mybeepr

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!

tonsnoei avatar Jun 24 '23 17:06 tonsnoei

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.

ewfian avatar Jul 24 '23 07:07 ewfian

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.

euantorano avatar Jul 24 '23 09:07 euantorano

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!

lahirumaramba avatar Jul 25 '23 18:07 lahirumaramba

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.

Doris-Ge avatar Jul 25 '23 18:07 Doris-Ge

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.

danports avatar Jul 26 '23 20:07 danports

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 avatar Aug 22 '23 06:08 R4DIC4L

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?

R4DIC4L avatar Aug 22 '23 10:08 R4DIC4L

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.

Doris-Ge avatar Aug 23 '23 19:08 Doris-Ge

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?

hanselsen avatar Dec 14 '23 08:12 hanselsen

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

EricaLi123 avatar Dec 15 '23 01:12 EricaLi123

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?

alex-radch avatar Apr 12 '24 15:04 alex-radch

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.

tonsnoei avatar Apr 14 '24 13:04 tonsnoei

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

Igouist avatar Apr 25 '24 12:04 Igouist

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

tonsnoei avatar Apr 25 '24 12:04 tonsnoei

Step 1:

go to https://developers.google.com/oauthplayground/

1.Select the autorize api and after fill the input your own scopes (email, https://www.googleapis.com/auth/firebase.messaging) once it is complete after displayed the client id and client secret key for refresh_token.

Step 2: POST => https://developers.google.com/oauthplayground/refreshAccessToken

{"token_uri":"https://oauth2.googleapis.com/token","refresh_token":"1//04BZzVDcaVl4vCgYIARAAGAQSNwF-L9IrPUzn_0****"} in body

Step 3:

POST =>> https://fcm.googleapis.com/v1/projects/chat-2dc2d/messages:send

headers: Bearer Y29**********.......

{ "message": { "token": "*********", "notification": { "title": "Sample", "body": "Sample" } } } in body

Sankarvjss78 avatar Jul 25 '24 10:07 Sankarvjss78