Very bad mistake about using async/await.
Таймураз Кайтмазов
11

This code throw an error:

function y() {
return new Promise((resolve) => { resolve() });
}
function x() {
const x = await y();
}

This code is ok:

function y() {
return new Promise((resolve) => { resolve() });
}
async function x() {
await y();
}