Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoose is not fully compatible with cls #4

Open
freeworlder opened this issue May 1, 2020 · 0 comments
Open

Mongoose is not fully compatible with cls #4

freeworlder opened this issue May 1, 2020 · 0 comments

Comments

@freeworlder
Copy link

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.

@freeworlder freeworlder changed the title Mongoose is not fully compatible with cps Mongoose is not fully compatible with cls May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant