Skip to content

[FEAT] : fixed Webhook Redelivery Nested Payload Bug #3155

Open
hrshjswniii wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
hrshjswniii:feature/Nested-Payload-Bug
Open

[FEAT] : fixed Webhook Redelivery Nested Payload Bug #3155
hrshjswniii wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
hrshjswniii:feature/Nested-Payload-Bug

Conversation

@hrshjswniii

Copy link
Copy Markdown
Contributor

Summary

This PR resolves the double-nested payload formatting bug during manual webhook redeliveries. The retry route handler now parses the logged WebhookPayload database record and extracts the original inner data dictionary before re-triggering the dispatch, ensuring the payload structure matches initial dispatch formats.

Closes #3128


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • Custom Webhook Retry Route (src/app/api/webhooks/custom/[id]/deliveries/[deliveryId]/retry/route.ts):
    • Parsed the database-retrieved delivery.payload.
    • Added extraction checks for the inner data block of the WebhookPayload wrapper.
    • Forwarded the flat originalData parameter to dispatchWebhook to prevent nested wrapper replication during retry dispatches.
  • Redelivery Integration Tests (test/webhook-retry-route.test.ts):
    • Created a new test file validating that the retry route correctly parses and extracts the nested data block of logged webhook delivery details.

How to Test

  1. Run the retry route tests:
    node node_modules/vitest/vitest.mjs run test/webhook-retry-route.test.ts
  2. Verify that the unit test succeeds.

Expected result:
The unit test passes cleanly, confirming the payload extraction.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Additional Context

  • The fix resolves input formats safely at the API boundary, guaranteeing that the core dispatch engine in src/lib/webhooks.ts remains unmodified and clean for standard live events.

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) gssoc26 GSSoC 2026 contribution labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] : Webhook Redelivery Nested Payload Bug

1 participant