Skip to content

docs: Add Nuxt payload verification example #200

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wobsoriano
Copy link

No description provided.

@wobsoriano wobsoriano requested a review from a team as a code owner March 28, 2025 21:24
Copy link

vercel bot commented Mar 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svix-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 28, 2025 9:28pm

Copy link

vercel bot commented Mar 28, 2025

Deployment failed with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

Copy link
Member

@svix-jplatte svix-jplatte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!


export default defineEventHandler(async (event) => {
const headers = getRequestHeaders(event);
const payload = await readBody(event);
Copy link
Member

Choose a reason for hiding this comment

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

I tried to find documentation on readBody, I didn't find a definitive reference but a few hints like https://www.reddit.com/r/Nuxt/comments/1aowr1p/access_raw_body_of_stripe_event/ that say that it parses the request body. It is important that the payload passed to wh.verify is the raw body. The suggestion from the linked reddit thread is to use readRawBody, can you verify that the following works in your codebase?

Suggested change
const payload = await readBody(event);
const payload = await readRawBody(event);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants