1

I've been using Google cloud storage api to upload some files. I've run into some errors of socket hang up when using the request for the upload.

After searching a bit, I've came across Error: socket hang up code: 'ECONNRESET' on Google cloud storage which solved the issue using:

.createWriteStream({
      resumable: false,
      validation: false,
       ...
    }

I couldn't find any documentation about those parameters (resumable and validation) and why using them solved my issue. How those parameters works on this context?

Apoorva Chikara
  • 8,277
  • 3
  • 20
  • 35
PedroSG
  • 466
  • 2
  • 9
  • 38
  • 1) Your code does not show the complete OS/Environment/API/Method/SDK Version that you are using/calling. 2) Make sure you have an **error** event handler to log the actual error. 3) I do not think setting **resumable** and **validation** fixed your problem. I think that covered up the actual problem. Cloud Storage could be too busy to handle your request at that instant (rare), there is a protocol problem or many other possibilities. – John Hanley Nov 18 '21 at 18:18

1 Answers1

2

According to the reference for the Cloud Storage API for Node, the resumable property is used to force a resumable upload. Resumable uploads are helpful to bypass connection errors when uploading objects to Cloud Storage buckets. In this context, the resumable property appears useful, since ECONNRESET errors include connection timeouts. As for the validate property, it is used to perform checksum validations.

I also noticed that the thread you linked does not use the provided upload method of the API, which, as per the docs, is a wrapper for File.CreateWriteStream() and is the method used to upload files as per the documentation and related threads.

ErnestoC
  • 2,660
  • 1
  • 6
  • 19