Skip to content

fix: parse raw body Buffer in Vercel webhook controller#27384

Merged
ThyMinimalDev merged 1 commit intomainfrom
devin/1769686334-fix-vercel-webhook-body-parsing
Jan 29, 2026
Merged

fix: parse raw body Buffer in Vercel webhook controller#27384
ThyMinimalDev merged 1 commit intomainfrom
devin/1769686334-fix-vercel-webhook-body-parsing

Conversation

@ThyMinimalDev
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a bug where the Vercel webhook endpoint was returning 200 OK but not actually triggering the trigger.dev promotion.

Root cause: The RawBodyMiddleware provides the request body as a Buffer for signature verification. However, the controller was trying to access payload.type directly on the Buffer, which is always undefined. This caused the check payload.type !== "deployment.promoted" to always be true, returning early with { status: "ignored" } without calling the trigger.dev API.

Fix: The controller now properly parses the raw Buffer into JSON before checking the event type. It also handles the test environment case where the body may already be a parsed object.

How should this be tested?

  1. Deploy to Vercel and trigger a deployment promotion webhook
  2. Verify that logs now show "Vercel Promoted! Promoting Trigger.dev to: {version}"
  3. Verify that the trigger.dev API is actually called

Environment variables required:

  • VERCEL_PROMOTE_WEBHOOK_SECRET - webhook signature verification
  • TRIGGER_SECRET_KEY - bearer token for trigger.dev API
  • TRIGGER_VERSION - deployment version to promote

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no docs changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Human Review Checklist

  • Verify the JSON parse error handling is appropriate (returns error status instead of throwing)
  • Confirm the Buffer detection works correctly in production with RawBodyMiddleware

Link to Devin run

https://app.devin.ai/sessions/0531a7a6f6d6442e92e73eb9accc9adc

Requested by

@ThyMinimalDev

Co-Authored-By: morgan@cal.com <morgan@cal.com>
@ThyMinimalDev ThyMinimalDev requested a review from a team as a code owner January 29, 2026 11:35
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@graphite-app graphite-app Bot added foundation core area: core, team members only labels Jan 29, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@ThyMinimalDev ThyMinimalDev enabled auto-merge (squash) January 29, 2026 11:48
@github-actions
Copy link
Copy Markdown
Contributor

E2E results are ready!

@ThyMinimalDev ThyMinimalDev merged commit 447a028 into main Jan 29, 2026
119 of 125 checks passed
@ThyMinimalDev ThyMinimalDev deleted the devin/1769686334-fix-vercel-webhook-body-parsing branch January 29, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants