title: NodeJs: Exiftool geting error stdin error write EPIPE in AWS Lambda environment
body: <p>Exiftool geting error stdin error write EPIPE in aws lambda environment, getting below error:</p>
  
  <pre><code>{
  "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.&lt;anonymous&gt; (/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)"
  ]}
  </code></pre>
  
  <p>A function is working properly with NodeJs version 10.X and 12.X on AWS Lamda. I have a use this <a href="https://www.npmjs.com/package/exiftool-vendored" rel="nofollow noreferrer">https://www.npmjs.com/package/exiftool-vendored</a> package. I have using below function:</p>
  
  <pre><code>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(() =&gt; exiftool.write('/tmp/'+filename, { Keywords: metadata }))
        .catch(err =&gt; console.error(err))
        .then(()=&gt;uploadToS3(filename,attributename))
        .then(() =&gt; exiftool.end())      
    });
    s3.getObject("s3 details").createReadStream().on('error', function(err){
        console.log("here");    
    }).pipe(file);
  }
  </code></pre>
  
  <p>Please help me to resolve this issue.</p>
  
  <p>Thank you.</p>