Skip to content

Commit 158f369

Browse files
add api/webhook to public routes
1 parent 7cec7ff commit 158f369

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/api/webhook/route.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { Webhook } from "svix";
22
import { headers } from "next/headers";
33
import { WebhookEvent } from "@clerk/nextjs/server";
44
import { createUser, deleteUser, updateUser } from "@/lib/actions/user.action";
5-
import { json } from "stream/consumers";
65
import { NextResponse } from "next/server";
76

87
export async function POST(req: Request) {
98
// You can find this in the Clerk Dashboard -> Webhooks -> choose the endpoint
10-
const WEBHOOK_SECRET = process.env.WEBHOOK_SECRET;
9+
const WEBHOOK_SECRET = process.env.NEXT_CLERK_WEBHOOK_SECRET;
1110

1211
if (!WEBHOOK_SECRET) {
1312
throw new Error(
@@ -55,8 +54,6 @@ export async function POST(req: Request) {
5554
// For this guide, you simply log the payload to the console
5655
const eventType = evt.type;
5756

58-
console.log({ eventType });
59-
6057
if (eventType === "user.created") {
6158
const { id, email_addresses, image_url, username, first_name, last_name } =
6259
evt.data;

middleware.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
2020
const isPublicRoute = createRouteMatcher([
2121
"/",
2222
"/api/webhook",
23-
"/question(.*)",
23+
"/question/:id)",
2424
"/tags(.*)",
25+
"/tags/:id",
2526
"/profile/:id",
2627
"/community",
2728
"/jobs",

0 commit comments

Comments
 (0)