-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 application middleware not working - No matching layer found errors #4333
Comments
@hacksparrow, could you please take a look? Thanks. |
@prithviraj99 does it work fine without appDynamics integration? |
This file is where the middleware stuff is implemented - https://github.com/strongloop/loopback/blob/master/lib/server-app.js. |
Thank you @prithviraj99 for reporting the issue. In order to support middleware phases, LoopBack has to monkey-patch internal data structures used by Express to hold routes. Many monitoring agents (e.g. NewRelic) monkey-patch these internal structures too. Unsurprisingly, when two parties are patching the same place, a conflict can occur. In the past, we have fixed our middleware phases to recognize NewRelic patches - see #1131. Perhaps we need to implement a similar workaround to support appDynamics? |
@bajtos @hacksparrow @dhmlau , Sorry for the delay but this is the update i have - "I have identified the trouble caused by AppDynamics on application code (on loopback’s middleware router_stack) and understood that this was indeed fixed on the version of loopback v3.25.0 onwards. https://github.com/strongloop/loopback/blob/v3.25.0/lib/server-app.js This is the commit on Loopback’s official github page - edb8dbc Commit description - AppDynamics injects a proxy object into the router stack, which it uses for its network analysis. This is similar to how NewRelic adds a sentinel handler to the router stack. This commit adds a similar workaround so that loopback can find the original layer. Our service was having a version of loopback v3.12.0 and hence this problem existed in first place. I have fixed it by upgrading to higher 3.x version." |
Awesome, thank you for confirming the fix works for you! I am closing this issue as fixed via #4119 then. |
I have integrated my loopback application with appDynamics library and all the middlewares are not firing from then on.
Used the debug command - DEBUG=* npm start to get the logs and found these logs coming up.
All the middlewares declared through middleware.json and imperatively through app.middleware() command are having this error message - No matching layer found
Any idea what's going wrong here - Which loopback package is responsible for express routing implementation
The text was updated successfully, but these errors were encountered: