Async/await not working?
See original GitHub issueI try this:
let [one, two] = await connection.execute('SELECT EXISTS(SELECT 1 FROM bashbase.users WHERE email=?) AS "exists";', [req.body.email])
console.log(one, two)
(node:19626) UnhandledPromiseRejectionWarning: TypeError: (intermediate value) is not iterable
when I try to add a .then, it says connection.execute.then is not a function
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (6 by maintainers)
Top Results From Across the Web
javascript async/await not working - Stack Overflow
I am using the async/await keywords, but not having any luck. Any help appreciated. This is my attempt to try getting it to...
Read more >javascript - await does not wait for Promise to finish
@SachinHooda await operator can only be used inside an async function, failing this would throw a runtime error as "Can not use keyword...
Read more >Async/await - The Modern JavaScript Tutorial
In actuality, The `await` keyword breaks the synchronous flow and creates a new promise handler from every subsequent statement in the function; ...
Read more >How to use promises - Learn web development | MDN
Inside an async function, you can use the await keyword before a call to a function that returns a promise. This makes the...
Read more >JavaScript Async - W3Schools
"async and await make promises easier to write" ... Or simpler, since you expect a normal value (a normal response, not an error):...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
what about returning a Promise if no callback is provided?
@AdrianHastro I guess @SinghRajKr question was “is this example in top level scope? If yes, it won’t work because node does not have top level await yet” - see https://stackoverflow.com/questions/46515764/how-can-i-use-async-await-at-the-top-level