Closed DominicGBauer closed 8 months ago
I'm getting a similar error
TypeError: ProfilingIntegration is not a function
I'm using node 20, with no source map.
Following the default example on sentry.io just didn't work. Going to roll the profiling-node package back to an earlier version and see if I can get it to work.
@drobat how are you importing the module? Mind logging what the value of the module?
@JonasBa https://github.com/drobati/alia-bot On this project I ran the onboarding guide at sentry.io
npm install --save @sentry/node @sentry/profiling-node
Because they use mjs imports I had to convert it to cjs.
const Sentry = require("@sentry/node");
const { ProfilingIntegration } = "@sentry/profiling-node";
Sentry.init({
dsn: 'https://cfe2a99241ba7519ae7809b58053c173@o4506257044340736.ingest.sentry.io/4506257052401664',
integrations: [
new ProfilingIntegration(),
],
// Performance Monitoring
tracesSampleRate: 1.0,
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
});
const transaction = Sentry.startTransaction({
op: "test",
name: "My First Test Transaction",
});
setTimeout(() => {
try {
foo();
} catch (e) {
Sentry.captureException(e);
} finally {
transaction.finish();
}
}, 99);
I did this at the top of the index.js, so it happens immediately.
I have tried not destructing. Removing the new and using it like a function. Neither worked. I also weirdly can not cmd + click the library which in webstorm takes you to the packages types.d.js
I was able to find the package installed, and saw lib/index.js and found the module.exports, so it looks like it should be possible to destruct this and use the constructor on the class.
Not really sure what to do here.
Wow must be tired. I clearly dropped the require. My appologies. Fixed it.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
SDK Version
1.2.1
Link to Sentry event
No response
What environment is your node script running in?
Koa node backend Node 16.20
How is your code deployed and bundled?
Webpack 5
webpackfile.js
:Steps to Reproduce
webpack-cli -c webpackfile.js && node -r dotenv/config build/app.js
Expected Result
No error
Actual Result
TypeError: profiling_node_1.ProfilingIntegration is not a constructor
Webpack out for profiling: