Open andyjp opened 1 week ago
I narrowed the issue down to node-fetch. The example below works with Node but not with Deno.
import fetch from "node-fetch";
import { createReadStream, statSync } from "node:fs";
const url = "https://httpbin.org/put";
// head -c 131073 </dev/random > myfile # a byte more than 128KiB
const readableStream = createReadStream("./myfile");
const headers = {
"Content-Type": "application/octet-stream",
"Content-Length": statSync("./myfile").size,
};
const options = {
method: "PUT",
headers: headers,
body: readableStream,
};
const res = await fetch(url, options);
console.log("Response:", await res.json());
deno --version
output: deno 1.44.2 (release, aarch64-apple-darwin) v8 12.6.228.9 typescript 5.4.5When uploading a file > 128 kib with the bucket.upload function in @google-coud/storage, the function hangs.
Tested with the script found here: https://github.com/denoland/deno/issues/18730#issuecomment-2110467290 and @google-cloud/storage@7.11.2
Steps to reproduce
await storage.bucket(bucketName).upload(filePath, { destination: fileName, onUploadProgress: console.log })
head -c 131073 </dev/random > myfile
deno run -A script.ts upload-file [bucketName] myfile ./myfile
With a 128 kib file, it finishes:
It works fine with tsx:
Related: https://github.com/denoland/deno/issues/24215