-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core-http] upload 4000MB ArrayBuffer throw "invalid typed array length" #9481
Comments
@ljian3377 does this repro in the nodejs test? When I tried in a standalone NodeJS app, it went to the browser branch and throws this error
|
Sadly we reverted the code so it now goes the browser branch. it.only("put blob with maximum size", async () => {
recorder.skip("node", "Temp file - recorder doesn't support saving the file");
const maxPutBlobSizeLimit = 5000 * 1024 * 1024;
const arrBuf = new ArrayBuffer(maxPutBlobSizeLimit);
try {
await blockBlobClient.upload(arrBuf, maxPutBlobSizeLimit, {
abortSignal: AbortController.timeout(20 * 1000) // takes too long to upload the file
});
} catch (err) {
assert.equal(err.name, "AbortError");
}
}).timeout(timeoutForLargeFileUploadingTest);
|
This seems a limitation in NodeJs
|
So |
we might be able to work around it by converting large ArrayBuffer into Stream internally const bufferSize = 1000 * MB;
let offset = 0;
const inputStream = new PassThrough();
while (offset + bufferSize < arrBuf.byteLength) {
inputStream.push(Buffer.from(arrBuf, offset, bufferSize));
offset += bufferSize;
}
inputStream.push(Buffer.from(arrBuf, offset, arrBuf.byteLength - offset));
inputStream.push(null);
try {
await blockBlobClient.upload(() => inputStream, maxPutBlobSizeLimitInMB * MB, {
//abortSignal: AbortController.timeout(20 * 1000) // takes too long to upload the file
onProgress: (state) => {
console.log(state.loadedBytes);
}
});
} catch (err) { |
Are you suggesting we do this in our |
I was thinking about doing this in |
@ljian3377, Can you confirm that this is an issue due to node-fetch? If so, then moving to the new Azure Core v2 should fix this |
Yes it's caused by node-fetch issue node-fetch/node-fetch#893. |
@ljian3377 Given that this is a limitation in node-fetch, there is nothing much we can do here. |
ArrayBuffer does not have a hard limit while typed array has.
Assigning to core-http as the request is logged, but do not seem to hit the server.
To reproduce:
The text was updated successfully, but these errors were encountered: