The handler then creates a new promise object , and it will be returned so that promises can be bound.
Quote bluebird documentation for then ,
Returns a new promise, chained from this promise.
In your case
sdk.request(options)
returns a promise object and has an execution handler, which is the next then handler.
.then(function (value) { return value; });
but the then handler returns a new promise object that does not yet have an execution handler. This is why _fulfillmentHandler0 undefined .
You can confirm it as follows
var promise = require("bluebird").resolve(); console.log(promise);
will print
{ _bitField: 268435456, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _progressHandler0: undefined, _promise0: undefined, _receiver0: undefined, _settledValue: undefined }
since promise does not yet have an execution handler. But when you attach a handler to it, like this
var promise1 = promise.then(function () {}) console.log(promise);
will print
{ _bitField: 268435457, _fulfillmentHandler0: [Function], _rejectionHandler0: undefined, _progressHandler0: undefined, _promise0: { _bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _progressHandler0: undefined, _promise0: undefined, _receiver0: undefined, _settledValue: undefined }, _receiver0: undefined, _settledValue: undefined }
Note 1: There can be more than one execution handler in a single promise object. This is why the output above shows [Function] , which means an array of functions.
Note 2: You do not need to worry about the properties of Promise objects. These are implementation details.
According to the last comment ,
I want to register / check the data / value returned by sdk.request
Yes, you can do it very well with bluebird. You can just tap promise, and you can print the actual allowed value, for example
return sdk.request(options).tap(console.log);
will print the actual allowed value, and you can hook up a then handler to handle the allowed value.