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
Hi there,
Unfortunately mongoose is not fully compatible with cls. First find or other mongoose query breaks callbacks chain and cls context get cleared. So the first request would work (context is not null so Tennant id can be obtained). The second and next requests would be failing as context as null, Tennant id cannot be obtain so the db is set to 'test'.
CLS is generally known to be incompatible with lots of modules, mongoose is one of them.
Starting with version 14.1.0, node.js has its own analogue to cls - AsyncStorage. PR #3 is swapping cls for AsyncStorage that resolves the issue.
The text was updated successfully, but these errors were encountered:
freeworlder
changed the title
Mongoose is not fully compatible with cps
Mongoose is not fully compatible with cls
May 1, 2020
Hi there,
Unfortunately mongoose is not fully compatible with cls. First find or other mongoose query breaks callbacks chain and cls context get cleared. So the first request would work (context is not null so Tennant id can be obtained). The second and next requests would be failing as context as null, Tennant id cannot be obtain so the db is set to 'test'.
CLS is generally known to be incompatible with lots of modules, mongoose is one of them.
Starting with version 14.1.0, node.js has its own analogue to cls - AsyncStorage. PR #3 is swapping cls for AsyncStorage that resolves the issue.
The text was updated successfully, but these errors were encountered: