title: How to fix Error: ENOENT: no such file or directory, mkdir in aws lambda with docker
body: <p>I have created a lambda function and I am deploying it with docker to was lambda. Testing locally everything works fine as shown below</p>
  <pre><code>➜  ~ curl -XPOST &quot;http://localhost:9000/2015-03-31/functions/function/invocations&quot; -d '{
    &quot;dependencies&quot;: {
      &quot;@react-navigation/native&quot;: {
        &quot;version&quot;: &quot;5.9.8&quot;,
        &quot;dependencies&quot;: {
          &quot;react&quot;: &quot;17.0.1&quot;,
          &quot;react-native&quot;: &quot;0.64.0&quot;
        }
      }
    }
  }'
  {&quot;statusCode&quot;:200,&quot;body&quot;:&quot;{\&quot;message\&quot;:\&quot;Dependencies successfully processed.\&quot;,\&quot;manifest\&quot;:{\&quot;@react-navigation/native\&quot;:{\&quot;version\&quot;:\&quot;5.9.8\&quot;,\&quot;url\&quot;:\&quot;https://dependency-runner.s3.us-east-2.amazonaws.com/v1/packages/@react-navigation/native/5.9.8.bundle.js\&quot;}}}&quot;,&quot;headers&quot;:{&quot;Content-Type&quot;:&quot;application/json&quot;,&quot;Access-Control-Allow-Origin&quot;:&quot;*&quot;,&quot;Access-Control-Allow-Credentials&quot;:true,&quot;Access-Control-Allow-Headers&quot;:&quot;Origin,Accept,Content-Type&quot;,&quot;Access-Control-Allow-Methods&quot;:&quot;OPTIONS,POST,GET&quot;}}%
  </code></pre>
  <p>But when I deploy build, push and use it, it always gives the error <code>{&quot;message&quot;:&quot;ENOENT: no such file or directory, mkdir '/var/task/nodedownload/1804e297a6b49b811d3898ad69eea9c84d5e42e1fe1c741b2b9f8b18890aef86'&quot;}%</code></p>
  <p>Here is my dockerfile</p>
  <pre><code>FROM public.ecr.aws/lambda/nodejs:14
  
  RUN yum update -y \
      &amp;&amp; yum install -y \
          wget \
          curl \
          tar \
          make \
          autoconf \
          expectsudo \
          openssl-devel \
      &amp;&amp; yum -y groupinstall &quot;Development Tools&quot;
  
  ENV IS_LOCAL=0
  ENV FILESYSTEM_PATH=/var/task
  ENV NODE_MODULES_PATH=/var/task/node_modules
  
  RUN chown $USER -R 777  /var
  RUN chown $USER -R 777  /home 
  
  WORKDIR /var/task
  COPY package.json .
  
  RUN npm install
  
  RUN npm install --global yarn
  COPY . .
  RUN ./node_modules/.bin/babel src -d ./
  
  CMD [ &quot;index.handler&quot; ]
  
  </code></pre>
  <p>and the part causing issues is this I think
  <code>WorkingDirectory</code> is generated as below,</p>
  <pre><code> let hash = crypto.createHash(&quot;sha256&quot;);
        hash.update(JSON.stringify(body), &quot;utf8&quot;);
        let checksum = hash.digest(&quot;hex&quot;);
  
        const workingDirectory = path.join(ROOT_DIR, checksum);
        const manifestPath = path.join(workingDirectory, &quot;manifest.json&quot;);
  
        console.log(&quot;WORKING DIR IS&quot;+ workingDirectory )
  
  </code></pre>
  <pre><code>     if (!fs.existsSync(workingDirectory)){
              console.log(&quot;Directory doesn't exist. Creating&quot;);
              fs.mkdirSync(workingDirectory, { recursive: true });
          }
  </code></pre>
  <p>How do I solve this. I cannot even see contents of <code>console.log</code> on cloudwatch.</p>