-
Notifications
You must be signed in to change notification settings - Fork 215
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
[nuxt] [request error] [unhandled] [500] The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Promise #381
Comments
Would you be able to provide a reproduction? 🙏 |
@danielroe this would be sort of a clone in terms of npm packages and env setup I have, but I cannot reproduce the issue on codesandbox. (note I have some Locally and on the azure server we use I can definitely still reproduce the issue when I upgrade to 1.6.4. (Video below) Screen.Recording.2023-05-03.at.9.49.39.AM.mp4 |
Found it first introduced in 19d133d |
It suddenly worked in nuxt 3.5.1, and the workaround seemed to be buggy :( |
@so1ve so is the issue resolved now? |
I'm not sure. In my use case (nuxt) the issue is resolved, but h3 users may not. |
Hi @danielroe , I just run
Locally, the requests works fine. But in Firebase, where I deployed my application, shows:
The workaround still works: // @ts-expect-error - req.body is not defined in the type definitions
const body = await (event.node.req.body || readBody(event)); |
@danielroe , just created this Nuxt project with After deploy to Firebase, should show error when try to make a POST request to In Function logs shows:
|
Thanks @igorjacauna for the repro! It even works (or rather breaks) without deploying to Firebase. Change yarn add --dev firebase-tools
NITRO_PRESET=firebase yarn build
yarn firebase emulators:start --only functions,hosting
# From another terminal:
curl -X POST 'http://localhost:5000/api/issue' -H 'Content-Type: application/json' --data-raw '{"test":1}' |
Another related fix where firebase parses form-data requests as object into |
Environment
node: v16.17
nuxt: 3.4.2
nitro: 2.3.3
Reproduction
Nuxt API requests using useAsyncData + $fetch in frontend and server api uses
await readBody
Describe the bug
frontend request
server API composable
Additional context
Same issue as described here 19d133d by many others.
This latest release
1.4.0
seems to break things.There is a workaround but it doesn't feel like something we'd actually want to be doing all over projects.
19d133d#r109674536
Logs
[nuxt] [request error] [unhandled] [500] The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Promise
The text was updated successfully, but these errors were encountered: