Skip to content

Fix resource lifecycle webhook payload mismatch#218

Open
PremSharma-Intelegencia wants to merge 1 commit into
fleetbase:mainfrom
blockalicious-io:fix-resource-lifecycle-webhook-payload
Open

Fix resource lifecycle webhook payload mismatch#218
PremSharma-Intelegencia wants to merge 1 commit into
fleetbase:mainfrom
blockalicious-io:fix-resource-lifecycle-webhook-payload

Conversation

@PremSharma-Intelegencia
Copy link
Copy Markdown

Summary

This PR fixes a payload mismatch in SendResourceLifecycleWebhook.

Previously, the listener stored the API event using $event->getEventData(), but sent the webhook using $event->data. Because these values can be resolved at different times, the payload stored in api_events.data could differ from the payload actually sent to integrators.

This change computes the lifecycle payload once and reuses it for both the stored ApiEvent record and the outbound webhook request body.

Background

For order.completed webhooks, we observed cases where the payload recorded in the database did not match the payload sent to the webhook endpoint. This made it difficult to rely on api_events.data as an accurate record of delivered webhook data.

Changes

  • Compute $payload = $event->getEventData() once in SendResourceLifecycleWebhook
  • Store $payload in api_events.data
  • Send $payload as the outbound webhook body

Related PRs

Compute the resource lifecycle payload once in SendResourceLifecycleWebhook and use the same value for both the persisted ApiEvent data and the outbound webhook request body. This prevents webhook deliveries from diverging from the api_events.data record when the event snapshot and live model payload differ.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants