-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
Cloud Functions (2nd gen)
"h3": "^2.0.1-rc.5"
On [email protected] all works fine as expected.
Reproduction
This code with h3@v2 not work
import { onRequest } from 'firebase-functions/https'
import { H3, readBody } from 'h3'
import { toNodeHandler } from 'h3/node'
const app = new H3()
app.post('/', async event => {
const body = await readBody(event) // stucks forever here
return body
})
const nodeHandler = toNodeHandler(app)
export const app = onRequest(async (req, res) => {
await nodeHandler(req, res)
})This code with h3@v1 works.
import { onRequest } from 'firebase-functions/https'
import { createApp, createRouter, defineEventHandler, readBody, toNodeListener } from 'h3'
const app = createApp()
const router = createRouter()
router.post(
'/',
defineEventHandler(event => readBody(event))
)
app.use(router)
const nodeHandler = toNodeListener(app)
export const app = onRequest((req, res) => {
nodeHandler(req, res)
})Describe the bug
When try to read body from request it stucks until timeout.
After some debug i found that event.req.text() stucks too.
It leads to this code:
https://github.com/h3js/srvx/blob/main/src/adapters/_node/request.ts#L180-L195
As far as I debugged it, it does not fire any listners here.
Additional context
No response
Logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working