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
{{ message }}
Repository navigation
Loopback API returns wrong responses on simultaneous requests #2485
I've been experiencing a very odd behavior with loopback when querying it with simultaneous requests. sometimes I am getting the expected responses, but on other times I am getting the wrong responses.
Here is what I am doing:
On the client side I am sending 2 ajax GET requests to the following url's:
the Customer and Group models have a many to many relationship through a CustomerGroup table and in CustomerGroup I have another column called 'type'. I placed an observer on customer-group.js which observes 'access'. When it enters the observer I am grabbing the type from the url by fetching it from ctx.active.http.req.query.type and then I am assigning it to context.query.where.type (ctx equals to loopback.getCurrentContext(); and context is the function's parameter).
This seems to always work fine when I call it with postman, but when I am calling it from the client side with ajax, the responses get mixed up between the two requests. For example, I am getting part of the response that I should have received for type=2 in type=1 and vice versa, and sometimes I am only getting partial responses - Not all the record I should have received in the result are fetched in the response.
Can anyone help me figure out what's going on here?
Hi @ReLrO
As in the comment above by @alexDA14 , that's the current status of getCurrentContext()
If you are looking for another alternative or another way to fix it, please provide a sample repo so we can debug it. As you said, the proper responses are intermittent, so I will have to investigate using a sample repo. Thanks.
Activity
loay commentedon Jul 14, 2016
Hi @ReLrO
As in the comment above by @alexDA14 , that's the current status of
getCurrentContext()If you are looking for another alternative or another way to fix it, please provide a sample repo so we can debug it. As you said, the proper responses are intermittent, so I will have to investigate using a sample repo. Thanks.
bajtos commentedon Jan 9, 2017
I am closing this issue as there are not clear instructions how to reproduce it, plus we have deprecated
getCurrentContextAPIs. If the problem is still relevant, then please open a new issue in https://github.com/strongloop/loopback-context/issues and create a sample app reproducing the problem (see http://loopback.io/doc/en/contrib/Reporting-issues.html#bug-report).