Skip to content
Advertisement

SyntaxError: Unexpected reserved word, for await loop

I have a function like this:

JavaScript

but when I try to deploy it to firebase functions I got the following error:

JavaScript

Found this: https://github.com/nodejs/node/issues/21617 but I did set my ForLoop in an async function…

Advertisement

Answer

for-await loops are first available in node in version 10. You’re probably using an earlier node version either locally or in package.json.

You will need to make sure that you are using at least node 10 in both your local node that you use for deployment:

JavaScript

and also target node 10 in your package.json so Cloud Functions can be told which version to use for deployment:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement