You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys,
thanks a lot for this lib, I managed to get it running on node 8.6.0 with express and async/await. However, I would like to ask if it is possible to use it with other library that is using Bluebird promises - knexjs.org. My ultimate goal is to wrap knex.transaction with my own function that is going to set the transaction to namespace so the transaction can be accessed from other places.
I tried something with cls-bluebird or using ns.run or ns.bind without any success. It fails on Unhandled rejection Error: No context available. ns.run() or ns.bind() must be called first.. Accessing the namespace out of knex.transaction() works fine.
Thanks for any kind of help!
The text was updated successfully, but these errors were encountered:
@froxCZ Sorry for not commenting earlier. I am eager to use cls-hooked with Bluebird as well, natively that is, without monkey patching. There's been work to add AsyncResource to Bluebird which would make Bluebird compatible with async_hooks and cls-hooked, although it has somewhat stalled because of its performance scare. (IMHO, I'd take a 10x slower node with reliable cls anyday...)
Alternatively, you can try cls-bluebird which has very good test test coverage, although you can't use async/await with it as async/await uses native promises.
Hi! I'm just doing research about which approach is going to be most reliable, cls-hooked, or the old style of continuation-local-storage? I was specifically looking around for mentions cls-hooked of having to wrap a bunch of 3rd party modules in order to keep the context around. This is the only issue I could find that mentions something like that.
Does CLS-hooked work only with native promises? Will I have to wrap any library that uses a non-native promise implementation?
I'm guessing I'd just run my server, look at my logs, and see which logs are missing the request ID. Then I'd figure out which library to wrap.
Hey guys,
thanks a lot for this lib, I managed to get it running on node 8.6.0 with express and async/await. However, I would like to ask if it is possible to use it with other library that is using Bluebird promises - knexjs.org. My ultimate goal is to wrap
knex.transaction
with my own function that is going to set the transaction to namespace so the transaction can be accessed from other places.I tried something with cls-bluebird or using
ns.run
orns.bind
without any success. It fails onUnhandled rejection Error: No context available. ns.run() or ns.bind() must be called first.
. Accessing the namespace out ofknex.transaction()
works fine.Thanks for any kind of help!
The text was updated successfully, but these errors were encountered: