Skip to content

Fix webhook creation request parsing#87

Open
quappefeeder wants to merge 1 commit into
profullstack:masterfrom
quappefeeder:fix-webhooks-request-json
Open

Fix webhook creation request parsing#87
quappefeeder wants to merge 1 commit into
profullstack:masterfrom
quappefeeder:fix-webhooks-request-json

Conversation

@quappefeeder

Copy link
Copy Markdown

Fixes #86.

POST /api/webhooks is wrapped by withAuth, which passes the original request as event.request. The route tried to parse request.json() from an undefined variable, so valid authenticated webhook creation bodies were rejected as invalid JSON before validation or insert logic could run.

Changes:

  • Parse the body from event.request.json().
  • Add a regression test that exercises authenticated webhook creation and verifies the insert payload.

Local checks:

  • git diff --check
  • node --check src/app/api/webhooks/route.js
  • node --check tests/api/webhooks-route.test.js

Full Vitest was not run locally because this environment has no npm/pnpm/node_modules available.

via ugig gig, ugig user liudong-design

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.

POST /api/webhooks rejects valid JSON because request is undefined in withAuth handler

1 participant