Open natew opened 2 months ago
Can you provide a reproduction repository?
The only way I've been able to reproduce is in production with the tamagui.dev site. But that requires a lot of setup unfortunately.
I am now on hono 4.6.1 and the stack trace changed just a bit:
I'll check more into those file lines and see if I can figure out why this may be happening so I can setup a smaller repro.
Added a patch so right before the line:
const chunksize = end - start + 1;
I added a log:
if (isNaN(start) || isNaN(end)) console.log('nan start or end', start, end, range, parts)
And I can see it logging:
nan start or end NaN 22 bytes: 0-22 [ 'bytes: 0', '22' ]
Looks like the range you're getting here:
const range = c.req.header("range") || "";
if (!range) {
c.header("Content-Length", size.toString());
return c.body(createStreamBody(createReadStream(path)), 200);
}
c.header("Accept-Ranges", "bytes");
c.header("Date", stats.birthtime.toUTCString());
const parts = range.replace(/bytes=/, "").split("-", 2);
Is expected to be bytes=
but instead its bytes: 0-22
Hi @natew
Thank you for the issue and your consideration.
I'll check more into those file lines and see if I can figure out why this may be happening so I can setup a smaller repro.
Have you already got a smaller repo?
Seeing this error suddenly but no idea where it's coming from, hard for me to replicate as it's only in production on a decent sized stack, I've upgraded to latest versions
"hono": "^4.5.8",
and"@hono/node-server": "^1.12.1",
: