Skip to content

Doesn't work with streaming and yield #47

@mirismaili

Description

@mirismaili

What version of Elysia is running?

1.3.20

What version of Node Adapter are you using?

1.3.1

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

import node from '@elysiajs/node'
import Elysia from 'elysia'

const app = new Elysia({adapter: node()}).get('/', function* () {
  yield 'Working'
})

await app.handle(new Request('http://localhost/')).then(async (res) => console.log(await res.text()))

What is the expected behavior?

$ bun index.js
Working

What do you see instead?

$ node index.js
node:internal/deps/undici/undici:4645
          throw new TypeError("Received non-Uint8Array chunk");
                ^

TypeError: Received non-Uint8Array chunk
    at readAllBytes (node:internal/deps/undici/undici:4645:17)
    at async fullyReadBody (node:internal/deps/undici/undici:4609:22)
    at async consumeBody (node:internal/deps/undici/undici:5728:7)
    at async file:///.../index.js:8:102

Node.js v22.14.0

Additional information

No problem, if you replace yield with return.

Have you try removing the node_modules and bun.lockb and try again yet?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions