Bluebird warning "A promise was created in a handler but was not returned from it" Bluebird warning "A promise was created in a handler but was not returned from it" express express

Bluebird warning "A promise was created in a handler but was not returned from it"


First, try and update all your dependencies. There's been a recent version of Bluebird, which fixed an issue involving this warning.

Next, make sure you return from all your handlers.

Then, if you still get the warning (like I do) you can disable this specific warning. I chose to do so by setting BLUEBIRD_W_FORGOTTEN_RETURN=0 in my environment.


Don't disable warnings. They're there for a reason.

The typical pattern is that if your onfulfill or onreject handler causes a Promise to be constructed, it will return that Promise (or some chain derived from it) from the handler, so that the chain adopts the state of that Promise.

So Bluebird is keeping track of when it is running one of your handler functions, and also keeping track of when it's Promise constructor is called. If it determines that a Promise was created at any point while your handler is running (that includes anywhere down in the callstack), but that Promise was not returned from your handler, it issues this warning because it thinks you probably forgot to write the return statement.

So if you legitimately don't care about the Promise that was created inside the handler, all you have to do is explicitly return something from your handler. If you don't care about what is returned from your handler (i.e., if you don't care what value the Promise fulfills with), then simply return null. Whatever you return, the explicit return (specifically, a return value other than undefined) tells Bluebird that you think you know what you're doing, and it won't issue this warning.


Make sure that every place you have return statement which is the solution works for me.