Confusing warning: a promise was created in a handler but was not returned from it
See original GitHub issue- What version of bluebird is the issue happening on? -
3.4.7
- What platform and version? –
Chrome, Firefox, Safari (require('bluebird') + browserify)
- Did this issue happen with earlier version of bluebird? -
no, 2.9*
Should not .done()
to suppress the warning?
// some button.js
function onClick() {
this.loadOptions()
.then((options) => {
// some external event interface
this.trigger('loaded', options); // sync
})
.done();
}
// some external button listener like table.js
button.on('loaded', (e, options) => {
this.loadSomeData(options)
.then((data) => {
this.updateSelf(data); // sync
})
.done();
});
We have warning bacause promise from loadSomeData()
created in a handler of promise from loadOptions()
Also I think this warning works strange, two examples:
function test1() {
Bluebird
.resolve()
.done(() => {
Bluebird.resolve().done();
});
}
no warning above
function test2() {
Bluebird
.resolve()
.then(() => {
Bluebird.resolve().done();
})
.done();
}
warning happened
Guess the examples are equal, but warning happening
I think that in both cases, the warning shouldn’t be happen, because it is not possible to return promise in any case.
PS: all the examples are full synthetic but reflecting real cases
PPS: http://bluebirdjs.com/docs/api/promise.config.html#promise.config it says that all the options are false
by default, but I get the warnings while not explicitly set {warnings: false}
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why do I not get the warning "a promise was created in a ...
I observed some cases where I'm getting following warning: Warning: a promise was created in a handler but was not returned from it....
Read more >Changelog - Bluebird JS
The "a promise was created in a handler but not returned from it" warning now highlights the file, line and column where the...
Read more >Warning: A Promise Was Created In A Handler At But Was Not ...
Bluebird warning A promise was created in a handler but was not returned from it. Solution: First try and update all your dependencies....
Read more >warning: a promise was created in a handler but was not returned ...
Bluebird is a fully featured JavaScript promises library with unmatched performance. bluebird npm. This is a playground to test code. It runs a...
Read more >Process | Node.js v19.3.0 Documentation
The 'unhandledRejection' event is emitted whenever a Promise is rejected and no error handler is attached to the promise within a turn of...
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
bluebird
was getting loaded by other third party libraries, so this didn’t work for me, not sure why, maybe the other libs are overriding this config at some point.However, this did
source: http://bluebirdjs.com/docs/api/promise.config.html
I did pick up on that, but that’s hardly a solution either as it requires me to refactor a lot of my code, and doesn’t solve the issue with warnings originating from 3rd party libraries.
In the end I found this to disable these pesky warnings: