update clerk webhook endpoint to work using the verifyWebhook clerk h…#49
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR renames the Clerk webhook env var from Changes
Sequence Diagram(s)sequenceDiagram
participant Clerk as Clerk (Webhook sender)
participant Server as Server Route `/api/webhooks/clerk`
participant SDK as Clerk SDK `verifyWebhook`
participant Handler as App Event Handler
Clerk->>Server: POST /api/webhooks/clerk (headers + body)
Server->>SDK: verifyWebhook(request)
SDK-->>Server: returns event OR throws verification error
alt verification succeeds
Server->>Handler: pass verified event
Handler-->>Server: 200 OK
else verification fails
SDK-->>Server: throws Error
Server-->>Clerk: 400 Invalid signature
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cd4a0ab to
10fbf65
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Line 12: Update the CI workflow secret mapping so the GitHub secret name
matches the environment variable: change the referenced secret from
CLERK_WEBHOOK_SECRET to CLERK_WEBHOOK_SIGNING_SECRET in the workflow where
CLERK_WEBHOOK_SIGNING_SECRET: ${{ secrets.CLERK_WEBHOOK_SECRET }} is defined;
also update the GitHub repository secret name to CLERK_WEBHOOK_SIGNING_SECRET so
secrets.CLERK_WEBHOOK_SIGNING_SECRET is available and consistent with the other
mappings like DISCORD_API_KEY and RESEND_API_KEY.
In `@apps/web/vite.config.ts`:
- Around line 19-21: The empty array for server.allowedHosts causes Vite to
reject tunnel hostnames (breaking Clerk webhooks via ngrok/cloudflared); update
the server.allowedHosts setting (in the server config object) to permit tunneled
hostnames—either set allowedHosts to 'all' or include the specific tunnel host
patterns/domains (e.g., '*.ngrok.io' or your cloudflared domain) so webhook
requests reach your webhook handler; modify the server.allowedHosts entry
accordingly in the vite config.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f1d9ea28-608c-432d-b634-6cca782f58c0
📒 Files selected for processing (5)
.github/workflows/ci.ymlapps/web/.env.exampleapps/web/src/env.tsapps/web/src/routes/api.webhooks.clerk.tsapps/web/vite.config.ts
10fbf65 to
46c7bbb
Compare
…elper
Summary by CodeRabbit