title: Promise function doesn't trigger after another promise
body: <p>I'm working on a microcontroller that would either take docx files or html strings in input and would transform it into a singular pdf file and return its link as an ouput.</p>
  <p>My code looks like this so far:</p>
  <pre class="lang-js prettyprint-override"><code>// 'files' is an array of uploaded docx files.
  const uploaded = files.map((file) =&gt; {
      return new Promise((resolve, reject) =&gt; {
          pump(
              file.toBuffer(),
              fs.createWriteStream(join(__dirname, 'files', file.filename))
                  .on('finish', resolve)
            )
       })
  })
  
  Promise.all(uploaded)
      // Is triggered
      .then(async () =&gt; await convertFiles())
      // Is not triggered
      .then(async () =&gt; {
          // concatStoreFiles() is an external function because I need it somewhere else too
          test = await concatStoreFiles(join(__dirname, 'files'))
          console.log({test})
          res.send(test)
      })
  
  
  const convertFiles = () =&gt; {
      return new Promise((resolve, reject) =&gt; {
  
          const cmd = `soffice --headless --convert-to pdf --outdir ${join(__dirname, 'files')} ${join(__dirname, 'files', '*.*')}`
          exec(cmd, (error, stdout, stderror) =&gt; {
              if (error) console.warn(error)
  
              resolve(stdout ?? stderror)
          })
      })
  }
  </code></pre>
  <p><strong>concatStoreFile.js</strong></p>
  <pre class="lang-js prettyprint-override"><code>module.exports = async function concatFiles (dirPath, outPath) {
      return new Promise ((resolve, reject) =&gt; {
          const existingFiles = []
          fs.readdir(dirPath, (e, files) =&gt; {
              files.forEach((file) =&gt; {
                  // is added to the files list only if finishing with &quot;.pdf&quot;
                  if (/[\d\w_-]+.pdf/.matches(file)) {
                      existingFiles.push(file)
                  }
              });
  
              resolve(existingFiles)
         })
      })
  }
  
  </code></pre>
  <p>I'm working with Insomnia for my development / test process, and it tells me that I get an empty response. However, I'm supposed to get an array of pdf files existing in a specific directory. I'm not even getting <code>console.log({test})</code>, so I don't think my second <code>then()</code> is triggered.</p>
  <p>I'm really rusty with async / await and Promise syntaxes, what should I do in this situation?</p>
  <p>Thank you in advance</p>