-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
bugSomething isn't working and you are sure it's a bug!Something isn't working and you are sure it's a bug!no updateThe owner doesn't provide further feedback.The owner doesn't provide further feedback.nodejsNodeJS backend agent relatedNodeJS backend agent related
Milestone
Description
Search before asking
- I had searched in the issues and found no similar issues.
Apache SkyWalking Component
NodeJS Server Side Agent (apache/skywalking-nodejs)
What happened
When skywalking-nodejs is used in the project, mongoose will have errors like this:
dict_info_1.default.findOne(...).lean is not a function.
and the source code is like this:
const result = await DictInfoModel.findOne({ dict_key: 'xxx' }).lean().exec();
I tried to browse through the skywalking-nodejs code and found that there is a piece of code like this in the MongoosePlugin.ts file:
if (!hasCB) {
if (ret && typeof ret.then === 'function') {
// generic Promise check
ret = wrapPromise(span, ret);
} else {
// no callback passed in and no Promise or Cursor returned, play it safe
span.stop();
return ret;
}
}
ret is changed to Promise at ret = wrapPromise(span, ret);, no longer has mongoose methods.
And this is the version information I use:
mongoose: ^4.7.3
skywalking-nodejs: 0.6.0
What you expected to happen
mongoose can run correctly
How to reproduce
- Create a project using mongoose
- Install
skywalking-nodejs - Write
mongoosequery code:tableName.findOne().lean().exec() - Run app and will see an error in the console
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working and you are sure it's a bug!Something isn't working and you are sure it's a bug!no updateThe owner doesn't provide further feedback.The owner doesn't provide further feedback.nodejsNodeJS backend agent relatedNodeJS backend agent related