milo icon indicating copy to clipboard operation
milo copied to clipboard

this.memory.buffer.subarray is not a function Error

Open mjackson opened this issue 1 year ago • 1 comments

When there is an error in one of my callbacks, I get the following error from milo's fail handler:

TypeError: this.memory.buffer.subarray is not a function
    at Object.fail (/Users/michael/Projects/remix-the-web/node_modules/.pnpm/@[email protected]/node_modules/@perseveranza-pets/milo/index.js:40:37)
    at runCallback (/Users/michael/Projects/remix-the-web/node_modules/.pnpm/@[email protected]/node_modules/@perseveranza-pets/milo/index.js:18:13)
    at wasm://wasm/00036016:wasm-function[25]:0x57e2
    at wasm://wasm/00036016:wasm-function[6]:0x68f
    at wasm://wasm/00036016:wasm-function[47]:0x74a3
    at Object.parse (/Users/michael/Projects/remix-the-web/node_modules/.pnpm/@[email protected]/node_modules/@perseveranza-pets/milo/index.js:35:15)
    at file:///Users/michael/Projects/remix-the-web/packages/node-fetch-server/src/lib/serve.ts:172:33
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Node.js v22.8.0

It looks like memory.buffer is an ArrayBuffer, but you're expecting it to be a TypedArray.

mjackson avatar Sep 09 '24 07:09 mjackson

Looking into this a bit further, it looks like this behavior was introduced in https://github.com/ShogunPanda/milo/commit/04f3673e4af1f435ebcf9e1d65ee30f2dd3383cd#diff-a439b77f7755dc3c938b4e914e26d1bbabc3e72060ad35824cbcbf26b90ad9a8R50

mjackson avatar Sep 09 '24 07:09 mjackson

Fixed in #12.

ShogunPanda avatar Apr 20 '25 08:04 ShogunPanda