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

Does loopback.getCurrentContext() work dependably? #2251

Closed
roberttaylortech opened this issue Apr 22, 2016 · 3 comments
Closed

Does loopback.getCurrentContext() work dependably? #2251

roberttaylortech opened this issue Apr 22, 2016 · 3 comments
Labels

Comments

@roberttaylortech
Copy link

Wondering if loopback.getCurrentContext() actually works dependably and what the issues are. We've had non-stop problems with storing/pulling context using any sort of mechanism similar to the way that loopback.getCurrentContext() appears to work. Why? Various reasons; including everyone/every module using different Promise implementations, some of which play nicely with domains, other which don't. Native Promises don't seem to play nicely using domains.

I see various commentary here regarding loopback here, but not sure where it stands exactly how to resolve:
/issues/878
whoGloo/loopback-jwt/pull/2

Also see my extensive comments/perspective on this issue:
nodejs/node/issues/66

@0candy
Copy link
Contributor

0candy commented Apr 26, 2016

Many users have had issues with getCurrentContext. It is unstable and there has been plans of deprecating it: #1676

Maybe you can try the alternative to inject remote context via options.
#1495

@0candy
Copy link
Contributor

0candy commented Apr 26, 2016

Closing as dup of #878

@0candy 0candy closed this as completed Apr 26, 2016
@roberttaylortech
Copy link
Author

Thanks, glad I asked and thank you for the clear answer: loopback.getCurrentContext() uses CLS. CLS is definitely not dependable and context breaks in many places (I documented a bit of that here: nodejs/node#66).

Reviewed the solution. CLS doesn't work. Domains don't work. Both break under quite a variety of conditions. This looks like a great way to get context always injected down into the models. @

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants