Repository navigation
fix(marketplace): retry failed agreement events instead of dropping them - #195
Merged
stewartjarod merged 1 commit intoOct 19, 2026
Conversation
The worker caught every per-record error, logged it, and returned success, so SQS deleted the message. A transient database error on an activation never reached the retries or the dead-letter queue, and the buyer stayed pending. Report failed records as batch item failures (partialResponses is already on) so SQS retries just those and dead-letters them once spent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014QZmHPbcx2nhuuDHy86YQ2
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
stewartjarod
added a commit
that referenced
this pull request
Oct 19, 2026
* fix(marketplace): subscribe a consumer to the agreement-event dead-letter queue Co-authored-by: polylane[bot] <277585245+polylane[bot]@users.noreply.github.com> * fix(marketplace): only fail a still-pending subscription from the DLQ The main worker swallows per-record errors, so what dead-letters is a whole batch whose Lambda timed out or crashed. Records earlier in that batch may already have been applied, and failing them would mark a live subscription failed. Guard the update on status = pending and surface settled rows to Sentry without touching them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014QZmHPbcx2nhuuDHy86YQ2 * fix(marketplace): retry failed agreement events instead of dropping them (#195) The worker caught every per-record error, logged it, and returned success, so SQS deleted the message. A transient database error on an activation never reached the retries or the dead-letter queue, and the buyer stayed pending. Report failed records as batch item failures (partialResponses is already on) so SQS retries just those and dead-letters them once spent. Claude-Session: https://claude.ai/code/session_014QZmHPbcx2nhuuDHy86YQ2 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Jarod Stewart <949393+stewartjarod@users.noreply.github.com> Co-authored-by: polylane[bot] <277585245+polylane[bot]@users.noreply.github.com> Co-authored-by: stewartjarod <stewartjarod@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jarod Stewart <jarod@wraps.dev>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #189. Merge that first; this PR then retargets to
main.Problem
marketplace-eventscaught every per-record error, sent it to Sentry, and returned success, so SQS deleted the message. A transient failure (a dropped DB connection, say) on an activation event was never retried and never dead-lettered. The buyer stayedpending, and the DLQ consumer added in #189 never saw it. Only Lambda-level failures (timeouts, crashes) reached the DLQ.Change
The handler now reports each failed record as a batch item failure and still never throws.
partialResponses: trueis already set on the subscription ininfra/marketplace.ts, so no infra change is needed. SQS retries just the failed record. After 3 tries it goes toMarketplaceEventsDlq, where #189's consumer marks a still-pendingsubscriptionfailed.Retrying is safe because every write is idempotent under redelivery: the status update is guarded on the event timestamp, and the welcome email on its conditional claim.
Malformed JSON is reported too. It will fail all 3 tries and land in the DLQ, which logs it. That costs two extra no-op invocations and keeps one path for every failure.
Tests
batchItemFailures: [m-bad](replaces the "swallows" test)batchItemFailures: []🤖 Generated with Claude Code
https://claude.ai/code/session_014QZmHPbcx2nhuuDHy86YQ2