node-s3-uploader
node-s3-uploader copied to clipboard
TimeoutError: Connection timed out after 10000ms
TimeoutError: Connection timed out after 10000ms
The image is uploaded on s3 with all their sub variations but after uploading i am getting error for Connection timeout
Your environment
- Operating system
- Linux
- Node.js version (
node --version
)- Node.js v6.x
- ImageMagick version (
identify -version
)- ImageMagick v7.0.x
- s3-uploader version
- v2.x
Steps to reproduce
below is my code
var client = new s3Upload(awsbucket, {
aws: {
path: 'images/',
region: 'us-west-2',
acl: awsACL,
accessKeyId: awsKeyId,
secretAccessKey: awsKey,
},
cleanup: {
versions: true,
original: false
},
original: {
awsImageAcl: 'public-read'
},
versions: [{
maxHeight: 1040,
maxWidth: 1040,
format: 'jpg',
quality: 80,
suffix: '-large',
folderPath: 'large/'
}, {
maxWidth: 780,
aspect: '3:2!h',
suffix: '-medium',
folderPath: 'medium/'
}, {
maxWidth: 320,
aspect: '16:9!h',
suffix: '-small',
folderPath: 'small/'
}, {
maxHeight: 250,
maxWidth: 250,
aspect: '1:1',
suffix: '-thumb',
folderPath: 'thumb/'
}]
});
var fileCounter = 0;
var filepath = req.file.path;
var filename = req.file.filename;
client.upload(filepath, {}, function (err, versions, meta) {
if (err) {
throw err;
}
versions.forEach(function (image) {
fileCounter++;
console.log(image);
console.log('versions.length',versions.length);
console.log('fileCounter',fileCounter);
//console.log(image.width, image.height, image.url);
if (fs.existsSync(filepath)) {
fs.unlinkSync(filepath);
}
if (versions.length === fileCounter) {
var im =image.key.split('/');
return res.json({success: true, filename: im[im.length - 1]});
}
// 1024 760 https://my-bucket.s3.amazonaws.com/path/110ec58a-a0f2-4ac4-8393-c866d813b8d1.jpg
});
});
and getting error like belwo image
http://i.prntscr.com/62fad87356564e7f9bd3eb3bac93294a.png
any update on this?
From this aws sdk documentation Try this
aws: {
path: '...',
region: '...',
acl: '...',
httpOptions: { timeout: 120000 }, // Play with values here (milliseconds)
accessKeyId: '...',
secretAccessKey: '...',
}
tried the last solution, error just changed to:
RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
for anyone else who gets stuck on this one, double check your aws.region if it's the right one
By default the region is us-east-1
. If you have server in some other location, add the region
property in aws
key in client object. I solved it this way. Hope this helps. :)