We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://stackblitz.com/edit/nuxt-starter-cmsqm4?file=server%2Fapi%2Ftest.post.ts
Open Nuxt devtools, open Server routes, run the test api.
As suggested at https://h3.unjs.io/utils/request#readvalidatedbodyevent-validate, such library like zod can validate content from user data. As yup is such a zod library, I thought it would work like zod, but it doesn't..
No response
My logs on local is a quite different { "url": "/api/sale", "statusCode": 400, "statusMessage": "Validation Error", "message": "Cannot read properties of undefined (reading 'resolve')", "stack": "<pre><span class=\"stack internal\">at createError (./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:79:15)</span>\n<span class=\"stack internal\">at createValidationError (./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:245:9)</span>\n<span class=\"stack internal\">at validateData (./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:241:11)</span>\n<span class=\"stack internal\">at readValidatedBody (./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:455:10)</span>\n<span class=\"stack internal\">at process.processTicksAndRejections (node:internal/process/task_queues:95:5)</span>\n<span class=\"stack\">at Object.handler (./server/api/sale.post.ts:23:1)</span>\n<span class=\"stack internal\">at async ./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:1962:19</span>\n<span class=\"stack internal\">at async Object.callAsync (./node_modules/.pnpm/unctx@2.3.1/node_modules/unctx/dist/index.mjs:72:16)</span>\n<span class=\"stack internal\">at async Server.toNodeHandle (./node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:2249:7)</span></pre>", "data": {} }
The text was updated successfully, but these errors were encountered:
Ok, it looks like an issue from yup, when I tried body => newSaleSchema.validate(body), it works. Probably an issue about context loss.
body => newSaleSchema.validate(body)
Sorry, something went wrong.
No branches or pull requests
Environment
Reproduction
https://stackblitz.com/edit/nuxt-starter-cmsqm4?file=server%2Fapi%2Ftest.post.ts
Open Nuxt devtools, open Server routes, run the test api.
Describe the bug
As suggested at https://h3.unjs.io/utils/request#readvalidatedbodyevent-validate, such library like zod can validate content from user data. As yup is such a zod library, I thought it would work like zod, but it doesn't..
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: