TIL that when you do a fetch request to upload a FormData object containing a Blob (i.e. a multipart upload), Bun sets the filename of the part to "" (filename="") while Node.js sets it to “blob” (filename="blob"). The Bun version is parsed in the Cloudflare Workers parsing logic as not a file part at all, but a string! This… made for an interesting debugging session.
Bun version:
POST /uploads/undefined/parts/1 HTTP/1.1
x-api-key: sk_car_f1bQmchDDphTvHZJP14aNF
Content-Type: multipart/form-data; boundary=-WebkitFormBoundary603f01c6ade8412bb9aed76026dd5aa1
Connection: keep-alive
User-Agent: Bun/1.2.20
Accept: */*
Host: localhost:3000
Accept-Encoding: gzip, deflate, br, zstd
Content-Length: 5243094
---WebkitFormBoundary603f01c6ade8412bb9aed76026dd5aa1
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream
<DATA>
---WebkitFormBoundary3b78453f0cb946b4bc436dda5e193be5--
Node.js version:
POST /uploads/undefined/parts/1 HTTP/1.1
host: localhost:3000
connection: keep-alive
X-API-Key: sk_car_f1bQmchDDphTvHZJP14aNF
content-type: multipart/form-data; boundary=----formdata-undici-090585224843
accept: */*
accept-language: *
sec-fetch-mode: cors
user-agent: node
accept-encoding: gzip, deflate
content-length: 5243060
------formdata-undici-090585224843
Content-Disposition: form-data; name="file"; filename="blob"
Content-Type: application/octet-stream
------formdata-undici-075238484550--