Closed albertolobrano closed 8 years ago
If you set 'global.Promise = require("bluebird")' as recommended by loopback I don't think you would have this issue.
I may have missed that best practice in loopback: https://docs.strongloop.com/display/public/LB/Using+promises . To be honest, with you I prefer to declare all my dependencies and keep global as small as possible. Also, google uses require for bluebird inthe gcloud lib. Let me know what path you intend to follow. If we decide to set the global I think it should be highlighted in the docs.
The recommendation is based on using recent versions of Node, which has global Promise support built in. The standard approach in loopback 2.x to use an alternate Promise implementation such as bluebird was to override global.Promise.
In the upcoming loopback 3.x, they have moved to explicitly using bluebird within their own codebase, rather than using the global.Promise object. See https://github.com/strongloop/loopback/blob/master/3.0-RELEASE-NOTES.md#always-use-bluebird-as-promise-library
So with that in mind, I'd be happy to update this component to explicitly require bluebird throughout.
Perfect. I will keep this ticket open and add the require to the other sripts
Thanks @albertolobrano
You are using bluebird but you are not requiring it in the user context. Fot that reason is failing witht he message : TypeError: Promise.join is not a function
Adding var Promise = require("bluebird");
solves the issue.