1

Exiftool geting error stdin error write EPIPE in aws lambda environment, getting below error:

{
"errorType": "Runtime.UnhandledPromiseRejection",
"errorMessage": "Error: Error: stdin.error: write EPIPE(start errors/min: 246.91)",
"reason": {
    "errorType": "Error",
    "errorMessage": "Error: stdin.error: write EPIPE(start errors/min: 246.91)",
    "stack": [
        "Error: Error: stdin.error: write EPIPE(start errors/min: 246.91)",
        "    at BatchCluster.onStartError (/var/task/node_modules/batch-cluster/dist/BatchCluster.js:308:19)",
        "    at Object.onStartError (/var/task/node_modules/batch-cluster/dist/BatchCluster.js:172:57)",
        "    at /var/task/node_modules/batch-cluster/dist/BatchProcess.js:224:34"
    ]
},
"promise": {},
"stack": [
    "Runtime.UnhandledPromiseRejection: Error: Error: stdin.error: write EPIPE(start errors/min: 246.91)",
    "    at process.<anonymous> (/var/runtime/index.js:35:15)",
    "    at process.emit (events.js:210:5)",
    "    at process.EventEmitter.emit (domain.js:476:20)",
    "    at processPromiseRejections (internal/process/promises.js:201:33)",
    "    at processTicksAndRejections (internal/process/task_queues.js:94:32)"
]}

A function is working properly with NodeJs version 10.X and 12.X on AWS Lamda. I have a use this https://www.npmjs.com/package/exiftool-vendored package. I have using below function:

const exiftool = require("exiftool-vendored").exiftool
const event = {"files":{"original":"5.jpg"},"metadata":"model ORG123"}

for(var attributename in event.files){
//console.log(event.files[attributename]);
    const exiftool = require("exiftool-vendored").exiftool;
    console.log(exiftool);  
    downloadS3(exiftool,event.files[attributename],metadata,attributename);
}

function downloadS3(exiftool,filename,metadata,attributename) {
  var s3 = new AWS.S3();
  var file = fs.createWriteStream('/tmp/'+filename);
  file.on('close', function(){
    console.log("done1");
    exiftool
      .deleteAllTags('/tmp/'+filename)
      .then(() => exiftool.write('/tmp/'+filename, { Keywords: metadata }))
      .catch(err => console.error(err))
      .then(()=>uploadToS3(filename,attributename))
      .then(() => exiftool.end())      
  });
  s3.getObject("s3 details").createReadStream().on('error', function(err){
      console.log("here");    
  }).pipe(file);
}

Please help me to resolve this issue.

Thank you.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • I commented on another thread of yours, but I've opened an issue here: https://github.com/photostructure/exiftool-vendored.js/issues/69 – Mike S. Dec 03 '19 at 02:00

0 Answers0