title: Why does await not wait? And why does Sequelize neither respond nor error?
body: <p>As you can see in the .gif below, the first time I call my database it returns data successfully. But the next two times it neither returns nor errors, the asynchronous code simply disappears. And even worse, my await statement doesn't wait for the response, it just continues.  </p>
  
  <p>Can anyone tell me why the subsequent calls to Sequelize disappear?  And more importantly, why the calling code keeps running even though I've used <code>await</code>?</p>
  
  <p><a href="https://i.stack.imgur.com/QFt9r.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QFt9r.gif" alt="enter image description here"></a></p>
  
  <p>Here is the innermost code:</p>
  
  <pre><code>getRolesAndPermissionsForUser(userId: string): Promise&lt;[IRoleModel]&gt; {
      return new Promise&lt;[IRoleModel]&gt;( async (resolve: any, reject: any) =&gt; {
        try {
          const rows = await this._db.getSequelize().transaction( (transaction) =&gt; {
            return this._db.getSequelize().query(getRolesAndPermissionsForUserSql, { type: Sequelize.QueryTypes.SELECT, replacements: [userId]  });
          })
          resolve(this.convertRolesToTree(rows));
        }
        catch (error) { reject(error); }
      });
    }
  </code></pre>
  
  <p>called by:</p>
  
  <pre><code>async function hasPermission(hapiResolve: (response: any) =&gt; void, requestingUserId: string, requestedUserId: string, requestedUsersRoles: any[]): Promise&lt;boolean&gt; {
        return new Promise&lt;boolean&gt;( (resolve, reject) =&gt; {
          try {
            //user is seeng her own roles
            let result = (requestingUserId === requestedUserId);
  
            //user manages a franchisor the requestee is part of
            if (!result) {
              requestedUsersRoles.forEach( async (role) =&gt; {
                if (!result) { //may have found it last iteration
                  const userHasOrgPermission = await self._bouncer.doesUserHavePermission(null, requestingUserId, DatabaseIds.enum__permissions__canViewAllRolesOfAnyUseratThisFranchisor, role.franchisorId, null)
                  if (userHasOrgPermission) result = true;
                }
              })
            }
  
            //user manages a franchisee the requestee is part of
            if (!result) {
              requestedUsersRoles.forEach( async (role) =&gt; {
                if (!result) { //may have found it last iteration
                  const userHasOrgPermission = await self._bouncer.doesUserHavePermission(null, requestingUserId, DatabaseIds.enum__permissions__canViewAllRolesOfAnyUseratThisFranchisor, null, role.franchiseeId)
                  if (userHasOrgPermission) result = true;
                }
              })
            }
  
            if (!result)
              hapiResolve(responseHelper.getErrorResponse(ResponseErrorCode.notAuthorised));
            resolve(result);
          }
          catch (error) {
            console.trace(error);
            reject(error);
          }
        });
      }
  
    doesUserHavePermission(hapiResolve: (response: any) =&gt; void, userId: string, permissionId: string, franchisorId: string, franchiseeId: string): Promise&lt;boolean&gt; {
      return new Promise&lt;boolean&gt;( async (resolve, reject) =&gt; {
        try {
          const roles = await this._rolesQueries.getRolesAndPermissionsForUser(userId);
                  if (!this.doRolesHavePermission(roles, permissionId, franchisorId, franchiseeId)) {
            if (hapiResolve)
              hapiResolve(responseHelper.getErrorResponse(ResponseErrorCode.notAuthorised));
            resolve(false);
          }
          else resolve(true);
              }
        catch (error) {
          if (hapiResolve)
                  hapiResolve(responseHelper.getErrorResponse(ResponseErrorCode.unknownError));
                  reject(error);
              }
          });
    }
  </code></pre>