title: UnhandledPromiseRejectionWarning: TypeError: object is not iterable... when using await Promise.all(promises);
body: <p>I'm trying to generate PNG asynchronously with NodeJS.</p>
  <pre><code>async generateAnnualPNG(recap) {
      let promises = [];
      console.log(&quot;Generating images for annual reports&quot;)
      for (const meter of recap.meters) {
          const url = process.env.BASE_URL + &quot;operations/&quot; + recap.operation.name + &quot;/meters/&quot; + meter.prm + &quot;/annual_individual_report&quot;;
          promises.push(this.makePngScreenshot(recap, url, meter.prm, &quot;annual_2019-2020&quot;));
      }
      return promises
  },
  </code></pre>
  <p>with <code>makePngScreenshot</code>:</p>
  <pre><code>async makePngScreenshot(recap, url, meterId, filename) {
          axios.get(url, null); // Make the request to generate html page
          const destination = &quot;public/images/&quot; + recap.operation.name + &quot;/&quot; + recap.date_ini + &quot;_&quot; + recap.date_end + &quot;/&quot; + meterId
          return new Pageres({ delay: 2, filename: filename })
              .src(url, ['1300x650'], { crop: true })
              .dest(destination)
              .run()
  
      }
  </code></pre>
  <p>When I debug, I can see that the returned promises seems OK, it is an array of 7 pending promises.</p>
  <p>I call it from:</p>
  <pre><code>module.exports = {
  
      async generatePNGs(recap) {
          let promises = [];
          promises = this.generateAnnualPNG(recap)
  
          await Promise.all(promises);
          console.log(&quot;Done generating images&quot;)
      },
  </code></pre>
  <p>I never see <code>Done generating images</code> message... Why ?</p>
  <p>Here is the log:</p>
  <pre><code>Generating images for annual reports
  images.js:53
  (node:571426) UnhandledPromiseRejectionWarning: TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
      at Function.all (&lt;anonymous&gt;)
      at Object.generatePNGs (/home/julien/Code/customer_recap/images.js:17:34)
      at init (/home/julien/Code/customer_recap/index.js:113:44)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  &lt;node_internals&gt;/internal/process/warning.js:32
  (node:571426) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
  &lt;node_internals&gt;/internal/process/warning.js:32
  (node:571426) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>