Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Bluebird warning about promises #964

Closed
vcarel opened this issue Nov 9, 2015 · 2 comments
Closed

Bluebird warning about promises #964

vcarel opened this issue Nov 9, 2015 · 2 comments

Comments

@vcarel
Copy link

vcarel commented Nov 9, 2015

I'm getting a warning from Bluebird (the Promise lib) every time I use a Promise, e.g.:

Warning: a promise was created in a  handler but was not returned from it
    at EventLoop.done (/home/me/src/myproject/node_modules/zombie/lib/eventloop.js:589:11)
    at EventLoop.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at EventLoop.emit (events.js:166:7)
    at Immediate._onImmediate (/home/me/src/myproject/node_modules/zombie/lib/eventloop.js:688:71)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Browser.wait (/home/me/src/myproject/node_modules/zombie/lib/index.js:341:145)
    at lazyResolve (/home/me/src/myproject/node_modules/zombie/lib/index.js:390:40)
    at Object.then (/home/me/src/myproject/node_modules/zombie/lib/index.js:397:18)
From previous event:
    at Object.then (/home/me/src/myproject/node_modules/zombie/lib/index.js:397:32)

FYI, this is in a callback of a React JS application. So I don't want to return the Promise... React wouldn't do anything with it. I don't know what Bluebird expects, but I don't want to put a workaround of any kind in my app code.

Is there a clean way to get rid of this warning ?

PS: BTW, Bluebird does a lot more that the Promise API: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise
Is using Bluebird really necessary? Why not just using a polyfill like https://github.com/taylorhakes/promise-polyfill ?

@assaf
Copy link
Owner

assaf commented Nov 9, 2015

There's no need for a polyfill, Node 4.x supports promises natively. Bluebird is only used in specific places where it adds value, like for browser.wait. You can turn off warnings, check the Bluebird documentation.

@vcarel
Copy link
Author

vcarel commented Nov 16, 2015

Thanks & sorry for the late reply.
So I added the code snippet below at it worked.

const Bluebird = require('bluebird');
Bluebird.config({
     warnings: false,
});

FYI I found that in petkaantonov/bluebird#482

You can close the issue.

@assaf assaf closed this as completed Nov 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants