-
-
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
"mod.require is not a function" in database tracing integrations #3293
Comments
The only solution to this right now might be it - https://webpack.js.org/configuration/module/#moduleparserjavascriptcommonjsmagiccomments + us adding that comment in the codebase. In the next major release, every package will live in its own place, so there wont be no need for |
Closing the issue, as it seems like the original issue has been partially resolved or there is a working solution. I'd prefer someone to create a new issue with a fresh description if it's still an issue. |
@kamilogorek I am running into this issue with esbuild (esbuild 0.17.19, sentry 7.71.0) Would you be open to a PR that allows passing the resolved module directly as an option? e.g. new Sentry.Integrations.Postgres({ module: pg }), This would be similar to how sequelize's Alternatively, do you know of a fix similar to The solution I'm using locally (unfortunate that ts types also have a mismatch): import pg from 'pg';
class PostgresWithEsbuild extends Sentry.Integrations.Postgres {
// @ts-ignore
public loadDependency() {
return pg;
}
}
Sentry.init({
...
integrations: [new PostgresWithEsbuild()],
}); |
@aldenquimby feel free to open a PR, we can take a look! |
@AbhiPrasad here you go! #9227 |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)@sentry/serverless
Version:
Description
In the past we reported #2971, that issue was preventing us from upgrading Sentry. With the release of
6.0.4
some weeks ago things started to work like a charm.Once we were able to upgrade, we added Sentry performance tracing to our applications (frontend and backend) and it worked perfectly, however database tracing was missing. In order to improve this, we added the Postgres tracing integration to the backend. After investigating we found that the same issue from #2971 still is happening in the tracing system, not in the same way as #2971 (it does not crash the library) but prevents Postgres tracing to work. We are using version 6.2.1.
After adding the Postgres tracing integration as the documentation recommends, we noticed that the Postgres tracing was not working and found the next error in our logs:
After checking the Postgres integration source (same will happens for all database integrations) I found that it calls to the
dynamicRequire
util which in turn callsmod.require
.In order to validate that we were having the same error I cloned a local copy of
sentry-javascript
and added an error log to display the Javascript exception and linked this local copy to our project. These were the logs:The code that I modified to get the
TypeError: mod.require is not a function
error was in the postgres.ts file:It is important to note that the
mod.require
error seems to only happen when using Webpack. More details about this issue can be found in #2971 and #2515The text was updated successfully, but these errors were encountered: