JavaScript
JavaScript used await outside a valid async context
JavaScript found an await expression in code that is not an async function, async generator, or top-level module context.
JavaScript
JavaScript found an await expression in code that is not an async function, async generator, or top-level module context.
Observed message
SyntaxError: await is only valid in async functions, async generators and modules
Why it happens
How to fix it
Official reference
MDN: SyntaxError: await is only valid in async functions async generators and modulesRelated errors
Explore more