Skip to content
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

docs: add example of webhooks with App Router #60276

Merged
merged 1 commit into from
Jan 6, 2024
Merged

docs: add example of webhooks with App Router #60276

merged 1 commit into from
Jan 6, 2024

Conversation

leerob
Copy link
Member

@leerob leerob commented Jan 5, 2024

@leerob leerob requested review from a team as code owners January 5, 2024 17:50
@leerob leerob requested review from manovotny and delbaoliveira and removed request for a team January 5, 2024 17:50
@manovotny
Copy link
Contributor

@leerob I see the emphasis here is on "simple". Does that mean we want to keep out any mentions of security or revalidation, even if it’s just Good to know or inline JS comments? Otherwise, it LGTM.

const text = await request.text()
// Process the webhook payload
} catch (error) {
return new Response(`Webhook error: ${error.message}`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello 😶‍🌫️. I accidentally looked in and came across something painfully familiar.

"'error' is of type 'unknown'"

But I'm not sure if it's too much to add a check in the doc like if (error instanceof Error), but on the other hand, it seems like the right thing to do, as if the example shouldn't include an error.

@leerob
Copy link
Member Author

leerob commented Jan 6, 2024

@manovotny thinking we just keep this one simple, but could make add more here in the future!

@leerob leerob merged commit e566f32 into canary Jan 6, 2024
31 checks passed
@leerob leerob deleted the webhooks branch January 6, 2024 16:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants