nuxt-security
nuxt-security copied to clipboard
Nuxt-Security module reads body in middleware and trpc/any other libraries cannot read the body for input validation
Environment
- Operating System: Windows_NT
- Node Version: v22.14.0
- Nuxt Version: 3.16.1
- CLI Version: 3.23.1
- Nitro Version: 2.11.7
- Package Manager: [email protected]
- Builder: -
- User Config: app, build, compatibilityDate, css, experimental, future, imports, modules, nitro, pwa, runtimeConfig, security, site, typescript, unocss, vite, vuetify
- Runtime Modules: @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/test-utils/[email protected], @nuxtjs/[email protected], @pinia/[email protected], @unocss/[email protected], @vite-pwa/[email protected], @vueuse/[email protected], [email protected]
- Build Modules: -
Nuxt Security Version
v2.2.0
Default setup used?
Yes, the bug happens even if the security option is not customized
Security options
Reproduction
Related issue and code culprit https://github.com/wobsoriano/trpc-nuxt/issues/215#issuecomment-2756740781
Can provide a repro if it's necessary and I have time, hopefully it's an obvious enough issue, but just not sure of the correct way forward for this
Description
The TRPC mutation request with input validator should not hang.
Additional context
No response
Logs
Hey buddy,
Thanks for reporting this issue. I looked at the linked issue in TRPC and I can see why this can be a problem.
Do you maybe have an idea of how it could be solved? I looked at the comment from wobsoriano but I am not sure what does he mean by cloning the request. If you have some time trying to make it work, I will provide any help needed to make this bugfix live to unblock you :)
Good point, @wobsoriano Sorry for the mention here, but just wanted to clarify your thoughts, did you mean something like structured cloning the Request object? Apologies if I’m not across this, haven’t looked at much low level node stuff :c