Amazon S3:与服务器的套接字连接在超时期限内未读取或写入

我正在使用s3软件包将file upload到S3: https : //www.npmjs.com/package/s3 。 我写了下面的代码(基于代码示例):

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"); }); 

我得到了以下错误:

无法上传:RequestTimeout:您的套接字连接到服务器没有读取或写入超时期限内。 空闲连接将被closures。

你有什么想法如何解决这个问题?

我也检查了这个链接: amazon s3上传文件超时了 ,并没有帮我解决问题。