title: Amazon S3: socket connection to the server was not read from or written to within the timeout period
body: <p>I'm using s3 package to uploading a file to S3: <a href="https://www.npmjs.com/package/s3" rel="nofollow noreferrer">https://www.npmjs.com/package/s3</a>. 
  I wrote the following code (based on the code example): </p>
  
  <pre><code>var s3 = require('s3');
  
  
  var client = s3.createClient({
    maxAsyncS3: 20,     // this is the default 
    s3RetryCount: 3,    // this is the default 
    s3RetryDelay: 1000, // this is the default 
    multipartUploadThreshold: 20971520, // this is the default (20 MB) 
    multipartUploadSize: 15728640, // this is the default (15 MB) 
    s3Options: {
      accessKeyId: *****,
      secretAccessKey: ******,
      // any other options are passed to new AWS.S3() 
      // See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property 
    },
  });
  
  var params = {
    localFile: "*****",
  
    s3Params: {
      Bucket: "*****",
      Key: "*****",
      // other options supported by putObject, except Body and ContentLength. 
      // See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property 
    },
  };
  var uploader = client.uploadFile(params);
  uploader.on('error', function(err) {
    console.error("unable to upload:", err.stack);
  });
  uploader.on('progress', function() {
    console.log("progress", uploader.progressMd5Amount,
              uploader.progressAmount, uploader.progressTotal);
  });
  uploader.on('end', function() {
    console.log("done uploading");
  });
  </code></pre>
  
  <p>I got the following error: </p>
  
  <blockquote>
    <p>unable to upload: RequestTimeout: Your socket connection to the server
    was not read from or written to within the timeout period. Idle
    connections will be closed.</p>
  </blockquote>
  
  <p>Do you have any idea how to solve the problem?</p>
  
  <p>I also reviewed this link: <a href="https://stackoverflow.com/questions/12774909/amazon-s3-upload-file-time-out">amazon s3 upload file time out</a> , and it didn't help me solve the problem. </p>