title: What is the correct way to handle nested async await calls in Node?
body: <p>Trying to learn the async pattern in Javascript but it doesn't appear that it waits for the following line. In the following example, the collection is the request object and not the actual parsed body. Isn't <code>await</code> supposed to wait for the request to finish?</p>
  
  <pre><code>async function importUsers(endpoint) {
      const options = {
          data: search,
          uri: endpointCollection,
          headers,
      }
  
      try {
          const collection = await browser.post(options, (err, res, body) =&gt; JSON.parse(body))
          // collection is the request object instead of the result of the request
          const users = await collection.data.forEach(item =&gt; parseUserProfile(item));
  
          await users.forEach(user =&gt; saveUserInfo(user))
      } catch(err) {
          handleError(err)
      }
  }
  
  
  
  async function parseUserProfile({ username, userid }) {
      const url = userProfileString(username)
  
      try {
          const profile = await browser.get(url, headers, (err, res, body) =&gt; {   
              return { ... } // data from the body
          })
      } catch(err) {
          handleError(err)
      }
  }
  </code></pre>