I'm migrating from promises to async/await and I'm having what I think is a strange issue. In the second function I'm getting that teams is undefined. Logging to the console I can see that the function InsertAgents is running before selectTeams finishes. What could be the issue?
    let selectTeams = function (){
                const request = new mssql.Request(pool);
                let query = `SELECT * from teams`;
                request.query(query, (err, result) => {
                    if (err === null) {
                        return result.recordset;
                    } else {
                        utils.logger.error(err);
                        reject(err);
                        console.log(err);
                    }
                })
        };
let insertAgents = function (params) {    
    console.log(params);
};
        const teams = await selectTeams();
        const agents = await insertAgents(teams);
 
    