title: AWS Lambda error - No such file or directory
body: <p>I've deployed some code a AWS lambda and I am getting the following error:</p>
  <p><code>ENOENT No such file or directory found var/task/../data/cacert.pem</code></p>
  <p>The file it's looking for is within the lambda see image below:</p>
  <p><a href="https://i.stack.imgur.com/ByllE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ByllE.png" alt="enter image description here" /></a></p>
  <p>I used webpack to add the file there :</p>
  <pre><code>{
     from: 'node_modules/tinify/lib/data/cacert.pem', to: 'app/../data/cacert.pem'
  }
  </code></pre>
  <p>Can anyone help me understand whats causing this?</p>
  <p>Edit:</p>
  <p>The certificate file is being imported within the <code>handler.js</code> file see below:</p>
  <pre><code>let data = fs.readFileSync(__dirname &quot;/../data/cacert.pem&quot;).toString()
  </code></pre>
  <p>Please note that the above code is added by webpack when it bundles the app and I can't edit that import statement. The certificate is needed by aa third party library (tinify.js).</p>