-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Open
Labels
0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap34-feedbackbugfeature: webhooks
Description
- Ref: Webhooks cannot be executed - background job arguments cannot exceed 4000 characters tables#2132
webhook_listeners creates a background job with a payload from the webhook event.
If the payload is bigger then:
- Webhook is not created
- A request creating the event fails
background job arguments cannot exceed 4000 characters
server/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php
Lines 27 to 60 in 72c3793
| class WebhooksEventListener implements IEventListener { | |
| public function __construct( | |
| private WebhookListenerMapper $mapper, | |
| private IJobList $jobList, | |
| private LoggerInterface $logger, | |
| private IUserSession $userSession, | |
| ) { | |
| } | |
| public function handle(Event $event): void { | |
| $user = $this->userSession->getUser(); | |
| $webhookListeners = $this->mapper->getByEvent($event::class, $user?->getUID()); | |
| foreach ($webhookListeners as $webhookListener) { | |
| // TODO add group membership to be able to filter on it | |
| $data = [ | |
| 'event' => $this->serializeEvent($event), | |
| /* Do not remove 'user' from here, see BackgroundJobs/WebhookCall.php */ | |
| 'user' => (is_null($user) ? null : JsonSerializer::serializeUser($user)), | |
| 'time' => time(), | |
| ]; | |
| if ($this->filterMatch($webhookListener->getEventFilter(), $data)) { | |
| $this->jobList->add( | |
| WebhookCall::class, | |
| [ | |
| $data, | |
| $webhookListener->getId(), | |
| /* Random string to avoid collision with another job with the same parameters */ | |
| bin2hex(random_bytes(5)), | |
| ] | |
| ); | |
| } | |
| } | |
| } |
Intermediate solution: at least wrap it into a try catch block and log the error, so failed background job creation doesn't fail the request.
A proper solution is to store the data somewhere else or add support for large data in background jobs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap34-feedbackbugfeature: webhooks
Type
Projects
Status
Confirmed