-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(/integrations/webhooks/sync-data) update guide #1655
Conversation
Hey, here’s your docs preview: https://clerk.com/docs/pr/1655 |
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Roy Anger <[email protected]>
- `user.updated`: Triggers when user information is updated via Clerk components, the Clerk Dashboard, or Backend API. Listening to this event keeps data synced between Clerk and your external database. It is recommended to only sync what you need to simplify this process. | ||
- `user.deleted`: Triggers when a user deletes their account, or their account is removed via the Clerk Dashboard or Backend API. Listening to this event allows you to delete the user from your database or add a `deleted: true` flag. | ||
|
||
These steps apply to any Clerk event. To make the setup process easier, it's recommended to keep two browser tabs open: one for your Clerk [**Webhooks**](https://dashboard.clerk.com/last-active?path=webhooks) page and one for your [ngrok dashboard](https://dashboard.ngrok.com). | ||
|
||
<Steps> | ||
### Set up ngrok | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: After the 'Set up ngrok' section, the guide never refers to the ngrok dashboard. We could probably skip suggesting the customer keep this open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this note in case the customer needs to access their secrets again.
Co-authored-by: Roy Anger <[email protected]>
Co-authored-by: Roy Anger <[email protected]>
Incoming webhook events have no auth information. They come from an external source and will not be signed in or signed out. To allow access, the route must be public. | ||
|
||
The following example shows the recommended Middleware configuration for webhook routes. | ||
|
||
```ts {{ filename: 'middleware.ts' }} | ||
import { clerkMiddleware } from '@clerk/nextjs/server' | ||
|
||
// Make sure that the `/api/webhooks(.*)` route is not protected here | ||
export default clerkMiddleware() | ||
Incoming webhook events contain no authentication information. They come from an external source and won't be signed in or signed out, so the route must be public to allow access. | ||
|
||
export const config = { | ||
matcher: [ | ||
// Skip Next.js internals and all static files, unless found in search params | ||
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)', | ||
// Always run for API routes | ||
'/(api|trpc)(.*)', | ||
], | ||
} | ||
``` | ||
To configure your Middleware, refer to the [clerkMiddleware() guide](docs/references/nextjs/clerk-middleware). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you repeat information here.
also the sentence ends wtih "so the route must be public to allow access". and then the next sentence goes into configuring your middleware.
there should be some relational information that ties these two concepts together:
"so the route must be public to allow access. If you are using clerkMiddleware()
, you will need to ensure that the /api/webhooks(.*)
route is public. For more information on configuring routes with clerkMiddleware()
, see the reference.
also don't forget that clerkMiddleware() always needs to be in code snippets. even if it's in a link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I left a couple of super minor notes, but those are easy to fix and then this should be good to ship. 🚀
Co-authored-by: Roy Anger <[email protected]>
Co-authored-by: Roy Anger <[email protected]>
Important
🔎 Previews:
Explanation:
This PR: