I'm trying to work on a new nodejs project and want to use Sentry for error logging. I use a self hosted Sentry installation on the latest version and the official @sentry/node npm module. While trying to implement Sentry by using the example code in their documentation I get an error in the sentry dashboard.
"We've encountered 1 problem un-minifying your applications source code!" "Invalid Absolute Path URL"
When clicking on Read Guide I get sent to a help page about uploading source maps. However the code isn't minified and because of that I don't have a source map that I can upload. I did notice a difference between using commonjs and es6. When using es6 I get the error above but when using commonjs I still get an error about unminifying code but it shows a different error below it which is: "Sentry not part of build pipeline". This error also directs me to a guide but that guide also talks about source maps. When using es6 I don't see any source code but when using commonjs I do get to see the source code which doesn't look minified.
I want the source code to be shown when using es6, what am I doing wrong here?
See the code I use below, when switching between commonjs to es6 I comment the require, uncomment the import and change the package.json to set the type to module.
const Sentry = require("@sentry/node");
// or use es6 import statements
// import * as Sentry from '@sentry/node';
Sentry.init({
dsn: "dsn here",
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 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);
Sentry error with es6 Sentry error with commonjs
I tried to follow the Sentry documentation from scratch and followed the getting started steps to make sure no other code would be affecting the results. I did follow the "Add Readable Stack Traces to Errors" part but it eventually asked for build artifacts which I don't have because the code isn't being built/minified.