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

Fix mysql2 plugin install error #74

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Fix mysql2 plugin install error #74

merged 1 commit into from
Mar 10, 2022

Conversation

ruleeeer
Copy link
Contributor

@ruleeeer ruleeeer commented Mar 10, 2022

I've added an optional method to get the version information of the plugin. For most plugins it's not necessary to implement this method, the default require('lib/package.json') method can get its version, but the few libraries that specify export in package.json can't use default method. They must implement their own getVersion() method to get the version

Fix apache/skywalking#7879

@wu-sheng wu-sheng added this to the 0.4.0 milestone Mar 10, 2022
@wu-sheng wu-sheng added the bug Something isn't working label Mar 10, 2022
@ruleeeer
Copy link
Contributor Author

Also, for require('mysql/lib/connect') change to require('mysql').Connection also because of the restriction of the export field,The meaning of the export field can be viewed here:https://nodejs.org/dist/latest-v16.x/docs/api/packages.html
image

The export field of mysql2 is as follows:

"exports": {
    ".": "./index.js",
    "./promise": "./promise.js",
    "./promise.js": "./promise.js"
  }

This also means that except for require('mysql2'), require('mysql2/promise') and require('mysql2/promise.js'), all other requires are illegal, such as require('mysql2/lib/connection' ) and require('mysql2/package.json')

@ruleeeer
Copy link
Contributor Author

@wu-sheng
Could help to do this pr associated to Issue:apache/skywalking#7879 ,thanks

@wu-sheng
Copy link
Member

image

This should work.

Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ruleeeer

@kezhenxu94 kezhenxu94 merged commit 466543d into apache:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Nodejs][Bug] Getting error log "Error installing plugin mysql2 *" when start agent
3 participants