ERR_CONNECTION_RESET Error when uploading large files to Amazon S3 ERR_CONNECTION_RESET Error when uploading large files to Amazon S3 heroku heroku

ERR_CONNECTION_RESET Error when uploading large files to Amazon S3


if you followed the instructions given in heroku documentation, you'll see a line

  const s3Params = {Bucket: S3_BUCKET,Key: fileName,Expires: 60,ContentType: fileType,ACL: 'public-read'};

As you can see in this aws documentaion ,the Expires metadata means that the number of seconds to expire the pre-signed URL operation.Here it is given as 60 which equals 1 minute. Uploading large files within the span of 60 sec. is not possible.

FIX:try removing the expire metadata from s3Params or increase the value.By default a presigned url expires in 15 minutes.

Now your code will look like this:

  const s3Params = {Bucket: S3_BUCKET,Key: fileName,ContentType: fileType,ACL: 'public-read'};