Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cloud Messaging: The firebase-admin-sdk cloud messaging migration from legacy FCM APIs to HTTP v1 #2518

Answered by mikejpeters
ak-notify asked this question in Q&A
Discussion options

As I can see from the sdk code, its still using legacy FCM APIs, is there any plan to migrate it to HTTP v1 ?
Or there won't be any changes in the sdk and it will continue to work even after June 2024.
Refer: Migrate to v1 by June 2024

You must be logged in to vote

@georgwiltschek is correct, the send() method has always used the v1 API since it was added to this SDK in 6.0.0, so it should be safe to use regardless of what version of the SDK you are on.

The sendToDevice / sendToDeviceGroup / sendAll / sendMulticast methods will stop working, and you have the option to switch to the send() method instead, or use the new APIs provided in SDK >= 11.7.0.

Sources

In the FAQ for FCM features deprecated in June 2023 there is a section on Firebase Admin SDK APIs:

API Name Impact on users Action Required
sendToDevice() The API will stop working after 6/21/2024 because it calls the legacy HTTP send API. Use the send() method.
sendToDeviceGroup() The ...

Replies: 5 comments 1 reply

Comment options

As I understand it, the Admin SDK Code has supported the HTTP v1 API for quite a while, but you have to use the messaging().send() Method instead of sendToDevice() (and other sendTo*-Methods), since the deprecatred sendTo*() Methods use the Legacy URLs. Someone please correct me if I'm wrong.

You must be logged in to vote
0 replies
Comment options

@georgwiltschek is correct, the send() method has always used the v1 API since it was added to this SDK in 6.0.0, so it should be safe to use regardless of what version of the SDK you are on.

The sendToDevice / sendToDeviceGroup / sendAll / sendMulticast methods will stop working, and you have the option to switch to the send() method instead, or use the new APIs provided in SDK >= 11.7.0.

Sources

In the FAQ for FCM features deprecated in June 2023 there is a section on Firebase Admin SDK APIs:

API Name Impact on users Action Required
sendToDevice() The API will stop working after 6/21/2024 because it calls the legacy HTTP send API. Use the send() method.
sendToDeviceGroup() The API will stop working after 6/21/2024 because it calls the legacy HTTP send API. Use the send() method.
sendAll() / sendAllAsync() / send_all() / sendMulticast() / SendMulticastAsync() / send_multicast() These APIs will stop working after 6/21/2024 because they call the batch send API . Upgrade to the latest Firebase Admin SDK and use the new APIs instead: sendEach() / sendEachAsync() / send_each() / sendEachForMulticast() / sendEachForMulticastAsync() / send_each_for_multicast(). Note that the new APIs no longer call the deprecated batch send API, and for this reason they may create more concurrent HTTP connections than the old APIs.

It also says that Node.JS Firebase Admin versions >=11.7.0 have the new APIs.

You must be logged in to vote
0 replies
Answer selected by ak-notify
Comment options

thanks for the complete response @mikejpeters i will try it now

You must be logged in to vote
0 replies
Comment options

would be niice to put a migration guide as sendToDevice has different arguments than send

You must be logged in to vote
1 reply
Comment options

also there is options argument for sendToDevice where we were defining

{
 priority: "high",
 timeToLive: 60 * 60 * 24,
 collapseKey:"key....",
 contentAvailable:true,
 restrictedPackageName:"com.app.id",
 };

and how to use this options object with suggested send method ?

Comment options

We recently migrated our push notifications from the Legacy HTTP API to the HTTP v1 API. Since then, push notifications are not working on either iOS or Android devices. Although FCM returns a "success" response, the messages are not being received by the devices.

Here's what we have done so far:

Migrated to the HTTP v1 API following the Firebase documentation.
Verified the entire code, especially the admin.messaging() module from the Firebase Admin SDK (we're using the send() method).
No errors or outages reported by FCM.
All relevant SDKs are up to date.
Tested whether low priority or message lifespan could be causing the issue – no success.
User devices are not in sleep mode and the app does not crash upon receiving the notification.

Has anyone experienced a similar issue or have any ideas about what could be causing this?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /