diff --git a/.changeset/calm-yaks-ring.md b/.changeset/calm-yaks-ring.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/calm-yaks-ring.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/backend/src/webhooks.ts b/packages/backend/src/webhooks.ts index fcc337d1008..0cebb68e345 100644 --- a/packages/backend/src/webhooks.ts +++ b/packages/backend/src/webhooks.ts @@ -63,23 +63,27 @@ function createStandardWebhookHeaders(request: Request): Record * See the [guide on syncing data](https://clerk.com/docs/guides/development/webhooks/syncing) for more comprehensive and framework-specific examples that you can copy and paste into your app. * * ```ts - * try { - * const evt = await verifyWebhook(request) + * import { verifyWebhook } from '@clerk/backend/webhooks' * - * // Access the event data - * const { id } = evt.data - * const eventType = evt.type + * export async function POST(request: Request) { + * try { + * const evt = await verifyWebhook(request) * - * // Handle specific event types - * if (evt.type === 'user.created') { - * console.log('New user created:', evt.data.id) - * // Handle user creation - * } + * // Access the event data + * const { id } = evt.data + * const eventType = evt.type + * + * // Handle specific event types + * if (evt.type === 'user.created') { + * console.log('New user created:', evt.data.id) + * // Handle user creation + * } * - * return new Response('Success', { status: 200 }) - * } catch (err) { - * console.error('Webhook verification failed:', err) - * return new Response('Webhook verification failed', { status: 400 }) + * return new Response('Success', { status: 200 }) + * } catch (err) { + * console.error('Webhook verification failed:', err) + * return new Response('Webhook verification failed', { status: 400 }) + * } * } * ``` */