-
Notifications
You must be signed in to change notification settings - Fork 539
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
Inconsistent readRawBody behavior in some nitro presets #912
Comments
Could you confirm with latest version of Nitro @Twitch0125 ? 🙏 |
Updated to nitro 2.3.1 and I am still seeing this issue. The reproduction repo and stackblitz link were also updated |
Seem related directly to h3: unjs/h3#363 |
unjs/h3#363 will support Buffer for The core of different types backs to the fact that raw input of providers is different (even for node for direct calls vs user fetch). While we might support to Buffer normalization more it adds more overhead. |
@pi0 Any ETA on this getting merged? |
This should be fixed via unjs/h3#366 and unjs/h3@19d133d Please upgrade lockfile and ping me to reopen if either Thanks for reporting the issue ❤️ |
Environment
nitropack: 2.1.1
node: 18.12.1
deno: 1.30.2
Reproduction
https://github.com/Twitch0125/nitro-inconsistent
(stackblitz works for node-server and cloudflare workers https://stackblitz.com/edit/nitro-inconsistent?file=readme.md)
pnpm install
pnpm run:node-server
orpnpm run:deno
orpnpm run:cloudflare
Describe the bug
It seems that some of the utils behave differently if they're in different environments. I'm not sure if this is actually an issue in Nitro, Unenv, or H3. Creating it for Nitro because it has the most stars so this might be seen by more people here.
When I try to get the raw body with
getRawBody
I'm seeing different return values if its running in Deno or Cloudflare Worker presets.Given a handler that looks like this
I can send it this json payload
and I'll get 3 different responses
node:
deno:
cloudflare:
Additional context
Looking into the code a bit, it looks like readRawBody() is checking a
event.node.req.body
property and then returns whatever that is. I'd guess the issue is in whatever codebase is setting thatbody
property.Logs
No response
The text was updated successfully, but these errors were encountered: