Hi Trevor,
The query has not completely executed yet in order to return the value of wRole when you get to the two console.log lines in your calling page code.
Consider creating a separate async function to call the findRole function. So, these three lines would be in that new async function where RoleFromQueryResults is the parameter passed to that function:
const wRole = await findRole(RoleFromQueryResults);
console.log("MP role = " + wRole);
console.log("Found memberProfile record");
Done this way, the above two console.log lines don’t run until the findRole function has completed.
Check out this article for an explanation of promises and async/await:
Velo: Working with Promises | Help Center | Wix.com