Skip to content
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

error 'chunk ArrayBuffer is zero-length or detached' since miniflare 2.8.X #374

Closed
cdloh opened this issue Sep 12, 2022 · 4 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@cdloh
Copy link

cdloh commented Sep 12, 2022

I've recently been updating my dependences going from miniflare 2.3.0 to 2.8.2 and I've started to get a bunch of errors from requests

    TypeError: Invalid state: chunk ArrayBuffer is zero-length or detached

      at Object.pull (node_modules/@miniflare/core/src/standards/streams.ts:141:22)

I'm not entirely sure how to track this down as the unit tests work fine in 2.7.X but breaks in any of the 2.8 versions.

I'm running it in the jest environment versioned the same as the miniflare environment.

I imagine it's something to do with the changes required for #168 but as far as I can tell I'm not using any features that weren't available.

@cdloh
Copy link
Author

cdloh commented Sep 12, 2022

I've tracked it down to this if block in streams.ts

https://github.com/cloudflare/miniflare/blob/master/packages/core/src/standards/streams.ts#L130-L142

The reader can sometimes get back a 0 ArrayBuffer

console.log(done)
VM1294:1 false
undefined
console.log(value)
VM1349:1 Uint8Array [buffer: ArrayBuffer(0), byteLength: 0, byteOffset: 0, length: 0]buffer: ArrayBuffer(0)  byteLength: 0byteOffset: 0length: 0Symbol(Symbol.toStringTag): (...)[[Prototype]]: TypedArray
undefined

@mrbbot mrbbot added the bug Something isn't working label Sep 12, 2022
@mrbbot mrbbot added this to the 2.9.0 milestone Sep 12, 2022
@mrbbot mrbbot closed this as completed in d36f399 Sep 12, 2022
@mrbbot
Copy link
Contributor

mrbbot commented Sep 12, 2022

Hey! 👋 Thanks for reporting and identifying the cause of this issue. 🙂 Should be fixed in the next release. 👍

@cdloh
Copy link
Author

cdloh commented Sep 13, 2022

@mrbbot great to hear! Do you have a particular release cadence?

@mrbbot
Copy link
Contributor

mrbbot commented Sep 17, 2022

Hey! 👋 Miniflare 2.9.0 has just been released, which implements a fix. You can find the full changelog here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants