Movatterモバイル変換


[0]ホーム

URL:


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

[Notifier][Firebase] Add Firebase v1 API support#60205

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vojtechsmejkal wants to merge8 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromvojtechsmejkal:notifier-firebase-v1-api-support

Conversation

vojtechsmejkal
Copy link

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?yes
IssuesFix#51147
LicenseMIT

This PR adds support for the newv1 API.

The main changes were:

  • Changed authorization process to use short lived JWT
  • Changed DSN shape to provide all information required by new API
  • New API endpoint was used
  • FirebaseOptions were extended to hold params supported by new API

This PR does not break backwards compatibility meaning that new Firebase bridge should behave the same way inside the Symfony app as the old one does right now.

Support for the old API was completely removed as the API has been shut down in 2024 already and attempting to use it throws exceptions.

Deprecations

  • $token param inFirebaseTransport::__construct() was deprecated - the param no longer exists for the new API
  • AndroidNotification,IOSNotification andWebNotification classes were deprecated - new Firebase API allows for all platform specific options to be specified for the message and having options separated by platform limits usability
  • If you attempt to use theFirebaseTransport with the old DSN format a deprecation notice is triggered to inform the user to upgrade (this has been done mainly to not break apps which have theFirebaseTransport configured with the old credentials format)

@carsonbotcarsonbot added this to the7.3 milestoneApr 12, 2025
@carsonbotcarsonbot changed the title[Notifier][Firebase] Add Firebase v1 API support[Notifier] [Firebase] Add Firebase v1 API supportApr 12, 2025
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.3 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot


return $sentMessage;
}

private function getJwt(): string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Generating JWT is quite a heavy operation and for example a messages worker dedicated to sending push notifications would perform this operation many times.

Can I add caching for the generated JWT? If so, should I addsymfony/cache dependency?

@vojtechsmejkalvojtechsmejkalforce-pushed thenotifier-firebase-v1-api-support branch 2 times, most recently from200ece1 toa83a711CompareApril 12, 2025 15:54
@vojtechsmejkalvojtechsmejkalforce-pushed thenotifier-firebase-v1-api-support branch froma83a711 to1ea778bCompareApril 12, 2025 16:20
@vojtechsmejkal
Copy link
Author

Sometests on Windows are failing. It seems likeext-openssl is not installed on that environment. If my assumption is correct, what is the preferred way to resolve this?

Rest of the failing tests seem to come from Doctrine bridge which should be unrelated to changes made in this PR.

@vojtechsmejkalvojtechsmejkalforce-pushed thenotifier-firebase-v1-api-support branch 2 times, most recently fromf213052 to4d52e8aCompareApril 21, 2025 08:40
@vojtechsmejkalvojtechsmejkalforce-pushed thenotifier-firebase-v1-api-support branch from4d52e8a to0259dceCompareMay 10, 2025 12:13
@Methraen
Copy link

Sometests on Windows are failing. It seems likeext-openssl is not installed on that environment. If my assumption is correct, what is the preferred way to resolve this?

Rest of the failing tests seem to come from Doctrine bridge which should be unrelated to changes made in this PR.

If im not wrong, only Symfony maintainers can modify the CI pipelines configuration,

@nicolas-grekas would it be okay to enable the missing ext so that the PR can be completed?

@OskarStarkOskarStark changed the title[Notifier] [Firebase] Add Firebase v1 API support[Notifier][Firebase] Add Firebase v1 API supportMay 23, 2025
@nicolas-grekas
Copy link
Member

Adding the extension is possible by patching .github/workflow files as fit.

Methraen reacted with thumbs up emoji

Vojtech Smejkal added8 commitsMay 25, 2025 16:45
New Firebase API uses JWT authorization and OpenSSL is needed for signing it.
…nion field from new APINew API changed the 'to' field into a union field with 3 different types. This adds backwards-compatible way to support targeting this union field in FirebaseOptions.
…the new v1 APIBackwards compatibility was maintained with the old DSN format. A deprecation is triggered when someone tries to create the transport with the old DSN format. Transport created using the old DSN will not be able to send messages and will throw exception for every sent message (this should be consistent with its previous behavior).
The private key used in tests was generated only for the purposes of these tests and is not connected to anything real.
… shapeShape of the endpoint input has changed with the new API. Separating options for messages based on the target platform no longer makes sense as all options for all platforms can now be set for the same message.AndroidNotification, IOSNotification and WebNotification were marked as deprecated and will be removed.FirebaseOptions is no longer abstract and should be used directly.
Reflects changes made by transferring to new v1 API.
Running tests there makes no sense since ext-openssl is needed.
@vojtechsmejkalvojtechsmejkalforce-pushed thenotifier-firebase-v1-api-support branch from0259dce to828c14cCompareMay 25, 2025 15:00
@vojtechsmejkal
Copy link
Author

I have rebased my branch and I have also modified.github/workflows/windows.yaml to exclude tests from this bridge to run on minimal extensions environment.

All tests have passed now.

@nicolas-grekas does this approach make sense?

Methraen reacted with thumbs up emoji

@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkAwaiting requested review from OskarStarkOskarStark is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

Firebase notifier does not work anymore since messaging protocol updated by google
5 participants
@vojtechsmejkal@carsonbot@Methraen@nicolas-grekas@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp