-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[express] express auto instrumentation no longer works if you enable profiling #14525
Comments
Talked with @vgrozdanic to find out more about how the bug occured - just auto-instrumenting sentry with profiling in express triggered this issue for them. He mentioned there could also be an interaction with Drizzle ORM. Going through the different scenarios to reproduce:
Having Drizzle ORM or not did not change the results. Tested Spans/Tracing with and without importing profiling, and I get this error:
Code: express-repro.zip |
I'm fairly certain this has something to do with profiling-node defining and using What we know for sure from the log message is that our SDK-internal sentry-javascript/packages/node/src/utils/ensureIsWrapped.ts Lines 23 to 33 in af773b1
|
Ok I think I found out what's going in: We only register the import-in-the-middle hook if our This is also apparent by an earlier log:
So the ESM modules (like express) cannot be instrumented. I'm not sure though about the implication of this. Does this mean profiling exclusively works in CJS apps 🤔 |
What I don't get is, that for some reason error monitoring is affected 😵 |
PR that hopefully fixes the missing instrumentation part: #13834 |
@shellmayr I could not reproduce the error part. I tried with automatic profiling as well as with |
@Lms24 @shellmayr just wanted to let you know that this is the first thing I'm looking at. I opened up a separate draft PR where I'm trying to scope createRequire. Unfortunately the e2e test I added wont pass, even though we don't store the result of createRequire call on globalThis. This makes me think its either not forcing mjs at runtime, or there is something else like the build step that provides it. In any case, I'm looking into this and will keep you updated. |
Thanks @JonasBa! 🙏
@Lms24 regarding this point, I think it breaks mostly when it is wrongly configured - the above test cases show that unless there is an error in the profiled section, the error monitoring works, so just configuring the integration does not seem to cause this behaviour. Let's get this fixed first and then see if the problem persists. |
After following the docs and https://docs.sentry.io/platforms/javascript/guides/express/profiling/
once the profiling is enabled, a message gets shown saying:
Also express instrumentation doesn't work.
Once the profiling is disabled, express instrumentation works.
The text was updated successfully, but these errors were encountered: