HonoRequest - Hono
Hey everyone!
I've got an annoying problem that I cannot solve with uploading multiple files over a
form-data
request to R2 with Hono.
The parseBody()
method is a utility from Hono https://hono.dev/api/request#parsebody to unpack the assets
Files to a single entry, then I try to loop over them and upload each one to R2 like so:
But no files are uploaded to R2, Miniflare reports [mf:err] TypeError: Can't read from request stream because client disconnected.
while on CF infra I can see that no data is passed to the logs, only empty objects {}
If I try with a single file it works and the file is uploaded correctly, what am I doing wrong?HonoRequest - Hono
Ultrafast web framework for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Lagon, Node.js, and others. Fast, but not only fast.
![No description](https://cdn.answeroverflow.com/1178297986523070554/Screenshot_2023-11-26_13-32-56.png)
1 Reply
Later Update:
In case someone encounters the same problem, it's the
forEach
loop that is broken, had problems with it in the past as well, just use a normal for
loop and it will upload as many files you can hold into the Worker RAM.
So Workers API for R2 can uplaod multiple files from one request!