-
Notifications
You must be signed in to change notification settings - Fork 364
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
loopback.getCurrentContext() is null #657
Comments
Since this seems to be a recurring issue with loopback, is there some workaround? If I can't have access to the request context then it means I can't use these remote method handlers at all. |
See strongloop/loopback#1495 strongloop/loopback#1495 Thanks, Raymond Feng StrongLoop http://strongloop.com/ makes it easy to develop APIs http://strongloop.com/mobile-application-development/loopback/ in Node, plus get DevOps capabilities http://strongloop.com/node-js-performance/strongops/ like monitoring, debugging and clustering.
|
so, something recently changed which broke And you don't intend to fix the I just want to be clear here. Is that what you are effectively saying by the above post? EDIT: not trying to sound snarky... just want to understand the best way to fix our app now (wait until you fix the .getCurrentContext bug that has been introduced, or attempt to hack the context in via 1495 above) |
strongloop/loopback#1495 is my proposal for a work around. The downside is that you must manually pass the
This is certainly concerning. We should fix this. We intend to fix any bug that prevents you to use any aspect of LoopBack. But practically speaking, the Personally I recommend to migrate to the strongloop/loopback#1495 work around. I expect this will eventually land as a first class citizen in strong-remoting and loopback core.
Trust me I can totally relate. I'm building several applications on LoopBack, and I have the same concern that you do. Personally, I have not made the jump to using |
OK, thank you for the detailed response. I will commence adding the context injection and ripping out our reliance on |
how would one get context information in a middleware if we're to remove the use of |
The simplest way to access the context is to bypass strongloop's remote method tools and specify handlers with express. From there you can access the context directly and pass it along with all of your function calls. It's an unfortunate solution but at the end of the day I would rather have something gritty and consistent than something nifty that works half the time. |
are you saying to remove the |
The former. Actually in our experience the endpoints created with |
that's sad to hear, I cannot remove our I did manage to fix the performance issue with the |
@wprater could you please elaborate on the performance issue and possible fix? I'm about to head for the |
@fabien you can see my notes here strongloop/loopback#1495 (comment) for a possible work around to fix these issues. but you might also start to read up on the discussions here too strongloop/loopback-context#2 |
@wprater which notes? Thanks in advance! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
This may be related to #631. This method returns null intermittently for some remote methods. I am using loopback v2.13.0, loopback-datasource-juggler v2.32.0, and async 1.0.0. Here is an example:
The text was updated successfully, but these errors were encountered: