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

channel does not work with Bluebird promises #2

Closed
druska opened this issue Feb 28, 2018 · 1 comment
Closed

channel does not work with Bluebird promises #2

druska opened this issue Feb 28, 2018 · 1 comment

Comments

@druska
Copy link

druska commented Feb 28, 2018

It seems like freezing the Promise object creates an issue when native promises are replaced with Bluebird promises.

Reproduction:
https://gist.github.com/druska/94fcf4bbdb8588391040b20915ed9bab

Result:

node --trace-warnings nodeguy_bluebird_issue.js

(node:86229) TypeError: Cannot assign to read only property '_promise0' of object '[object Object]'
    at Promise._addCallbacks (/private/tmp/node_modules/bluebird/js/release/promise.js:396:24)
    at Promise._then (/private/tmp/node_modules/bluebird/js/release/promise.js:270:16)
    at Promise.then (/private/tmp/node_modules/bluebird/js/release/promise.js:125:17)
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:686:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
(node:86229) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitWarning (internal/process/promises.js:78:15)
    at emitPendingUnhandledRejections (internal/process/promises.js:95:11)
    at process._tickCallback (internal/process/next_tick.js:189:7)
    at Function.Module.runMain (module.js:686:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
/private/tmp/node_modules/bluebird/js/release/promise.js:294
    this._bitField = this._bitField | 33554432;
                   ^

TypeError: Cannot assign to read only property '_bitField' of object '[object Object]'
    at Promise._setFulfilled (/private/tmp/node_modules/bluebird/js/release/promise.js:294:20)
    at Promise._fulfill (/private/tmp/node_modules/bluebird/js/release/promise.js:633:10)
    at Promise._resolveCallback (/private/tmp/node_modules/bluebird/js/release/promise.js:432:57)
    at /private/tmp/node_modules/bluebird/js/release/promise.js:484:17
    at Object.resolve (/private/tmp/node_modules/@nodeguy/channel/lib/index.js:17:9)
    at Immediate.processOrders [as _onImmediate] (/private/tmp/node_modules/@nodeguy/channel/lib/index.js:64:15)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
@NodeGuy
Copy link
Owner

NodeGuy commented Mar 13, 2018

Thank you for the reproduction. I've fixed this in the beta branch and will publish it soon.

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