EXCEPTION: Promise is not a constructor in v12.0.0-rc5
See original GitHub issueI am trying to get this working with an angular2 application. I am importing this (elasticsearch.js) into my component and then:
var connectionString = 'xyz';
this._client = new elasticsearch.Client({ host: connectionString, log: 'trace' });
ngOnInit() {
console.log('NGINIT');
/*this._client.search({
index: 'twitter',
type: 'tweets',
body: {
query: {
match: {
body: 'elasticsearch'
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
}, function (err) {
console.trace(err.message);
});
*/
}
so in my console I get:
DEBUG: 2016-10-02T12:09:56Z starting request { “method”: “POST”, “path”: “/plugins/document/_search”, “body”: { “query”: { “query_string”: { “query”: “Bluetooth” } } }, “query”: {} }
and then when I uncomment the this._client.search({
section, I get:
EXCEPTION: Promise is not a constructor
client.ping({ ...})
works as expected. and the issue goes away if I use v.11.0.1 rather than v.12.0.0-rc5
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Promise is not a constructor - javascript - Stack Overflow
With var Promise you declare a local variable in your scope. It is initialised with undefined and shadows the global Promise constructor.
Read more >Promise.resolve is not a constructor Error in JavaScript
The "Promise.resolve is not a constructor" error occurs when we try to use the `Promise.resolve()` method with the `new` operator. The `Promise.resolve()` ...
Read more >Promise() constructor - JavaScript - MDN Web Docs
The Promise() constructor is primarily used to wrap functions that do not already support promises.
Read more >Uncaught (in promise) TypeError: {......} is not a constructor ...
Describe the bug I'm using vanilla ts project with a very basic structure here I've imported the ...
Read more >Promises: Ember.RSVP is not a constructor - Learning Team
I am experimenting with Promises and trying to adapt a javascript Promise example I found to Ember. I'm getting this error in the...
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
totally works now, thanks
Apologies, I accidentally ignored the promise polyfill in the vanilla browser build. Fixed in
12.1.3
, which I just published.