question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

why can't I use async / await

See original GitHub issue

If I try to use syntax like async (req, res) => {... in my firebase function I get the error below when deploying. I assume it’s a language feature that’s not supported yet?

error Parsing error: Unexpected token =>

Removing the async makes it go away…

However, I have a dependency in my package (ccxt) that does use the async / await syntax, and it works just fine. Why is this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

49reactions
stamlercommented, Jan 14, 2019

If anybody else is continuing to receive this issue after doing the updates, make sure that "ecmaVersion": 8 is set in your .eslintrc.json as well.

27reactions
nathanjliucommented, Sep 13, 2018

async/await is only supported in the Node 8 runtime, which was only recently added as a beta runtime in firebase functions.

You can use it by adding the following to your package.json. "engines": { "node": "8" },

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I Don't Use Async Await - DEV Community ‍ ‍
One in the particular is not using async await. A warning, this is a minority view, and only some functional languages hold this...
Read more >
Cannot await on async method - Stack Overflow
As others have pointed out, await can only be used within an async method. However, you should not use async void !
Read more >
Why You Can't Use Async/Await. It's a powerful ... - Michael Long
So having async/await in the language doesn't help you a lot if, for example, you can't call the async/await version of URLSession. dataTask...
Read more >
Why I Don't Use Async Await – Software, Fitness, and Gaming
One in the particular is not using async await. A warning, this is a minority view, and only some functional languages hold this...
Read more >
Async/await - The Modern JavaScript Tutorial
Let's emphasize: await literally suspends the function execution until the promise settles, and then resumes it with the promise result. That ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found