You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If require.main.filename (the app entry point) is /Users/Tim/app/main.js and the filename we're trying to resolve module name for is /Users/Tim/app/some/great/feature.js, I would expect the module to end up being something like some.great.feature, however it ends up as just feature.
If we look at the code for getModuleFromFilename we can see that in the case of the above input, normalizedBase ends up being /Users/Tim/app/some/great/ whereas I think it should probably be /Users/Tim/app/.
The stack frame
module
property should be a:Take this example...
If
require.main.filename
(the app entry point) is/Users/Tim/app/main.js
and the filename we're trying to resolve module name for is/Users/Tim/app/some/great/feature.js
, I would expect themodule
to end up being something likesome.great.feature
, however it ends up as justfeature
.If we look at the code for
getModuleFromFilename
we can see that in the case of the above input,normalizedBase
ends up being/Users/Tim/app/some/great/
whereas I think it should probably be/Users/Tim/app/
.sentry-javascript/packages/node/src/module.ts
Lines 24 to 28 in 679e149
It looks like this was broken here in #7415, which means it's been broken since around v7.45.0.
Before, base was calculated from the
dirname(require.main.filename)
rather than thedir
of the filename we're trying to resolve:This likely happened because the tests for this have were not (and still aren't) sufficient:
https://github.com/getsentry/sentry-javascript/blob/develop/packages/node/test/module.test.ts
The text was updated successfully, but these errors were encountered: