When i am trying to upload the file and store in to s3 location, I got the error
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:205:27)
is the above a version problem or bug?
var express = require('express'),
aws = require('aws-sdk'),
bodyParser = require('body-parser'),
multer = require('multer'),
multerS3 = require('multer-s3');
aws.config.update({
secretAccessKey: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
accessKeyId: 'xxxxxxxxxxxxxxxx',
region: 'us-east-1'
});
var app = express(),
s3 = new aws.S3();
app.use(bodyParser.json());
var upload = multer({
storage: multerS3({
s3: s3,
bucket: 'xxxxx',
key: function (req, file, cb) {
console.log(file);
cb(null, file.originalname); //use Date.now() for unique file keys
}
})
});
//open in browser to see upload form
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
//used by upload form
app.post('/upload', upload.array('upl',1), function (req, res, next) {
res.send("Uploaded!");
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
and index html file
<form method="post" enctype="multipart/form-data" action="/upload">
<input type="file" name="upl"/>
<input type="submit"/>
</form>
and packages version
"dependencies": {
"aws-sdk": "^2.753.0",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"multer": "^1.4.2",
"multer-s3": "^2.9.0"
}
and my node and npm versionn is
node is :12.16.1 npm is: 6.13.4
Please any one solve this problem...