-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Webhook] Allow request parsers to return multiple RemoteEvent's
#58248
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
RemoteEvent'sRemoteEvent's
db75e57 to
fc5d44b
Compare
|
Makes sense to me. I think I never came across a service that sends webhook events by batches like this. But to me, that's a nice idea if this exists. I'd be 👍 on this, especially since the implementation is pretty simple! |
|
This is technically a BC break for callers of the parser (as the caller needs to be able to deal with an array). However, as the typical usage of this parser is to be called by the WebhookController of symfony/webhook (while external packages implement the interface), I would not oppose shipping that in a minor version of the component, with an explicit mention about that in the changelog and upgrade guide. But I'd like to know what other members of the core team think about it. |
|
Based on the comment in #50324 (comment), it seems like Sendgrid also batches webhooks but our parser silently ignore all events except the first one. |
😬 Once multiple messages can be parsed in one request, what are your thoughts on what to do when just one fails? Each parser could do there own thing if I'm understanding correctly. |
|
Each parser can have its own logic to decide when it returns |
fc5d44b to
74f7331
Compare
34c4903 to
130ae1b
Compare
This PR was merged into the 7.2 branch. Discussion ---------- [Webhook] add `WebhookController` tests | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | n/a | License | MIT Just adds tests to WebhookController to prepare for possible changes in #58248. Commits ------- 5bcd490 [Webhook] add WebhookController tests
130ae1b to
dde7b45
Compare
|
I've added tests, updated changelog and upgrade guide. If this minor BC Break is acceptable, I think this is good to go.
When/if merged, I'll fix the sendgrid bridge. |
dde7b45 to
da9aafb
Compare
|
As we already have 3 bridges that would work correctly without this change, I would consider this BC break as something we need to fix in 7.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about introducing a parseAll method?
RemoteEvent|array<RemoteEvent> is tricky to deal with I fear.
|
Adding a new method will be a BC break for all implementations . And right now, we have dozens of implementation, all in external packages (either in bridge components or third-party) while we have only 1 known caller in the webhook component itself (and so no impacted by a BC break as its update is shipped in the same package). |
da9aafb to
42fec2e
Compare
|
With an |
|
Or a new interface / abstract class. |
|
but that would still force bridges to implement the parse method returning a single one (and so being broken for batched webhooks) |
|
Just for curiosity: does this somehow allow streaming events to a webhook? |
No, just accounts for some webhook providers that send multiple events in a single request. |
I thought about this and then, in FYI, I did a search on packagist and couldn't find any open source code that consumes parsers. |
42fec2e to
d3d43cd
Compare
d3d43cd to
35c4f77
Compare
35c4f77 to
a1fcfae
Compare
|
Thank you @kbond. |
This PR was merged into the 7.2 branch. Discussion ---------- [Mailer][Webhook] Fix SendGrid Webhook parsing | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58398 | License | MIT Sendgrid sends multiple webhook events in a single request. Previously, only the first was parsed and the rest were silently ignored. This fix parses them all, but is only available on 7.2 because #58248 is required. Commits ------- 9ae908e [Mailer] enable Sendgrid to parse multiple events
I've run into services that send their webhook events in bulk - a single request containing multiple events.
This is one idea to allow this. I'd like to get some input before going further.
TODO: