Fix: Express plugin compatibility for Express 4.x and 5.x#126
Merged
kezhenxu94 merged 2 commits intoapache:masterfrom Feb 19, 2025
Merged
Fix: Express plugin compatibility for Express 4.x and 5.x#126kezhenxu94 merged 2 commits intoapache:masterfrom
kezhenxu94 merged 2 commits intoapache:masterfrom
Conversation
Contributor
Author
|
Sorry guys, I had to close the other PR because I did something wrong. |
Contributor
Author
|
@wu-sheng Can you check this other one please? |
Member
|
I'm not working on nodejs agent, need to wait for @kezhenxu94 to review. |
Member
|
And CI should pass, you should have verified the codes through all CI processes locally. |
Contributor
Author
|
Thanks for the reply, I am facing errors while trying to install node 14 on my macbook, there are some issues with the m1 cpus architecture. I will try run the tests in other computer later. |
kezhenxu94
approved these changes
Feb 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are evaluating the use of SkyWalking in our company, and I have started some proof-of-concept tests to evaluate the agents.
I created a new project using Node.js/NestJS and the SkyWalking Node.js agent, following the instructions provided on the NodeJS Agent page to install it in the project.
Versions used:
Upon initializing the project, I encountered the following error message:
{ message: 'Error installing plugin express *', level: 'error', file: '...node_modules/skywalking-backend-js/lib/core/PluginInstaller.js' }After investigating the code, I identified the root cause.
In the ExpressPlugin.js file, line 39:
The error
Cannot find module 'express/lib/router'occurs because the installed version of Express no longer has this folder structure (express/lib/router). This is due to recent versions of Express reorganizing their modules differently.To address this issue, I am adding compatibility for both older and newer versions of Express:
express.Router()(used in Express 5+).express/lib/router(used in Express 4.x).