Promise.all is not a function
See original GitHub issueI receive this error on Chrome 49.0.2623.87. I have es6-promise 3.2.1. I am packaging using webpack. Testing using the webpack development server. es6-promise is being included in webpack as a plugin:
plugins: [
new webpack.ProvidePlugin({
"Promise": "es6-promise",
"fetch": "imports?this=>global!exports?global.fetch!whatwg-fetch"
})
]
The call in my code (TypeScript) looks like:
return Promise.all(<Promise<any>[]> [CartService.find(), CatalogService.find()]);
CartService.find()
and CatalogService.find()
both return Promise
s.
When my code runs I receive the error:
Uncaught (in promise) TypeError: Promise.all is not a function
Looking at the JS sent to the browser I can see that this library is included in the bundled code.
If I comment out the line in my webpack.config.js
file then it runs fine (but there is obviously no polyfill).
What am I doing wrong?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Promise.all is not a function · Issue #5687 · nodejs/node - GitHub
The message is correct here. Promise.all is trying to call promise1[Symbol.iterator]() which is exactly what it's supposed to do, only to find ...
Read more >Promise.all() - JavaScript - MDN Web Docs
The Promise.all() method takes an iterable of promises as input and returns a single Promise . This returned promise fulfills when all of ......
Read more >Promise.all raises TypeError: undefined is not a function
The reason is that Promise.all expects an iterable . You are only returning 1 promise. Look: enter image description here.
Read more >JavaScript | Promise.all() Method - GeeksforGeeks
Here, Promise. all() method is the order of the maintained promises. The first promise in the array will get resolved to the first...
Read more >How to use JavaScript Promise.all with real-life code example
In this post, we will dissect how JavaScript Promise.all function works visually and with a real-life code example, let's get started!
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 FreeTop 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
Top GitHub Comments
@Sinewyk any recommendations for improving this for this project?
PR opened https://github.com/stefanpenner/es6-promise/pull/197