Skip to content

fix: process webhook events instead of silently returning 200 status - #7891

Merged
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
atul-upadhyay-7:fix/webhook-processing-7887
Jul 31, 2026
Merged

JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
atul-upadhyay-7:fix/webhook-processing-7887

Conversation

@atul-upadhyay-7

Copy link
Copy Markdown
Contributor

Description

This PR fixes the issue where the webhook endpoint receives events but fails to process them silently returning 200 status. The endpoint now properly processes webhook events by parsing, caching, and evaluating alerts.

Changes Made

  • Modified app/api/webhook/route.ts to:
    • Import parseWebhookEvent, cacheEvent, and evaluateAlerts from webhook-handler service
    • Parse the webhook payload to extract event data
    • Cache events for analytics and reporting
    • Evaluate and send alerts if configured
    • Add proper error handling and logging
    • Return appropriate success/error responses

Testing

  • All existing webhook handler tests pass (11/11 tests)
  • Linting passes with no new errors
  • Type checking shows no new issues related to this change

Impact

  • Webhook events are now properly processed and cached
  • Alert system can now trigger notifications for CI/CD events
  • Improved visibility into webhook health through logging
  • Better error handling for failed processing

Issue Reference

Fixes #7887

Labels

  • bug
  • level2
  • GSSoC 2026

Copilot AI review requested due to automatic review settings July 9, 2026 16:34
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@atul-upadhyay-7 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 9, 2026
@Aamodx6 Aamodx6 added mentor:Aamod007 level:intermediate Moderate complexity tasks type:bug Something isn't working as expected labels Jul 10, 2026

@Aamodx6 Aamodx6 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hello! Thanks for your work on processing webhook events instead of just returning a 200 status. Ensuring that we properly handle the payloads is crucial for data consistency. I noticed that the main \Format · Lint · Typecheck · Test\ CI workflow is failing. I have triggered a rerun of the CI pipeline for this PR to see if it was a flaky failure, but if it fails again, please fix the tests/linting errors locally and update this PR!

Labels assigned:

  • \level:intermediate: Dealing with webhook payload parsing and processing requires a good understanding of the data models.
  • \ ype:bug: Addresses an issue where payloads were ignored.

@atul-upadhyay-7
atul-upadhyay-7 requested a review from Aamodx6 July 10, 2026 18:17
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @atul-upadhyay-7, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

@Aamodx6 Aamodx6 added the quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. label Jul 17, 2026

@Aamodx6 Aamodx6 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixing the webhook processing logic in route.ts to actually handle events instead of silently returning 200 is a critical fix. However, the CI checks are failing. Please resolve the issues and rerun the CI pipeline.

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/app/api/webhook/route-[hash].js 0.26 KB - +0.26 KB (++100%) 🆕 New

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 4885.15 KB 4884.48 KB +0.67 KB (+0.01%)
Total CSS 346.79 KB 346.79 KB 0 B

@atul-upadhyay-7
atul-upadhyay-7 requested a review from Aamodx6 July 22, 2026 07:21

@Aamodx6 Aamodx6 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for opening this PR! The changes described in your PR description sound exactly like what's needed to fix the webhook processing issue.

However, it looks like there are no code changes included in this pull request (0 additions, 0 deletions). It seems you might have forgotten to commit your changes or push them to this branch before opening the PR.

Please make sure you have committed your modifications to \�pp/api/webhook/route.ts\ and pushed them to this branch. Once the code is here, we can proceed with a full review!

Label Justification:

  • \level:intermediate: Webhook parsing and event processing is an intermediate backend task.
  • \quality:clean: Applied as default pending full review.
  • \ ype:bug: Fixes silent failure in webhooks.
  • \mentor:Aamod007: Assigned as required.

@atul-upadhyay-7
atul-upadhyay-7 requested a review from Aamodx6 July 23, 2026 03:21

@Aamodx6 Aamodx6 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR has 3 commits but 0 files changed and an empty diff — it appears the changes are already in the base branch or the branch is out of date. Could you please check if this PR is still needed and rebase if appropriate?

@atul-upadhyay-7
atul-upadhyay-7 requested a review from Aamodx6 July 28, 2026 15:24
- Recreated /api/webhook route with proper event processing
- Imports parseWebhookEvent, cacheEvent, evaluateAlerts from webhook-handler
- Rate limiting, signature verification, and payload validation
- Returns appropriate success/error responses
- Added comprehensive test suite (10 tests)

Fixes #7887
@atul-upadhyay-7

Copy link
Copy Markdown
Contributor Author

@Aamod007 Thanks for the review! I've addressed the empty diff issue by recreating the webhook route with proper event processing.

What was wrong:
The legacy /api/webhook route was deleted during a merge conflict resolution, leaving the PR with 0 files changed.

Changes made:

  1. ✅ Recreated app/api/webhook/route.ts — Full webhook processing pipeline:

    • Rate limiting (10 requests/60s per IP)
    • GITHUB_WEBHOOK_SECRET validation
    • HMAC-SHA256 signature verification (timing-safe comparison)
    • Payload size validation (1MB limit)
    • Event parsing via parseWebhookEvent
    • Event caching via cacheEvent for analytics
    • Alert evaluation via evaluateAlerts for CI/CD notifications
    • Proper error handling and logging
  2. ✅ Added app/api/webhook/route.test.ts — 10 tests covering:

    • Signature verification (missing, invalid, valid)
    • Payload validation (empty body, invalid JSON)
    • Rate limiting
    • CI/CD event processing
    • Non-CI/CD event acknowledgment
    • Error handling

Validation results:

  • ✅ All 10 tests pass
  • ✅ Format clean
  • ✅ 367 lines added

Ready for re-review! 🙏

@JhaSourav07
JhaSourav07 merged commit 47e2ca7 into JhaSourav07:main Jul 31, 2026
8 of 11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @atul-upadhyay-7! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

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

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Webhook endpoint receives events but fails to process them silently returning 200 status

4 participants