yakovkhalinsky/backblaze-b2

Socket hang up on getUploadPartUrl

curti55 opened this issue · 2 comments

When uploading large Files i need to get UploadPartUrl for each part / chunk first.

Sending my Chunks like this:

b2.getUploadPartUrl({fileId:bbFileId}).then(
    function(){
        b2.uploadPart({
            partNumber: chunk.cnt,
            data: chunk.data,
            partSha1: chunk.partSha1,
            uploadUrl: uploadUrl,
            uploadAuthToken: token                
        });
    },
    reject);

results in getting

Error: socket hang up
    at createHangUpError (_http_client.js:331:15)
    at TLSSocket.socketOnEnd (_http_client.js:423:23)
    at emitNone (events.js:111:20)
    at TLSSocket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)`

for some parts / chunks.

Seems like calling getUploadPartUrl many times in a row will cause this error.

Looks like using axios current version (0.18.0) does the trick.
I don't get the error anymore

@curti55 Great! I'll close this then - feel free to reopen if you encounter the issue again.