sentry-javascript
sentry-javascript copied to clipboard
Initialization fails with bundled CommonJS
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
User issue: Initializing Sentry works when running it in a dev environment, but fails to initialize when using a CommonJS bundled file.
------------First 2 lines of CommonJs bundled server file server.js-------------------
"use strict";
require("./instrument");
---------- contents of instrument.js ----------------
const Sentry = require("@sentry/node");
const { nodeProfilingIntegration } = require("@sentry/profiling-node");
console.log("initializing Sentry for bundle");
const node = Sentry.init({
dns: 'https://{{redacted}}',
integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
Sentry.postgresIntegration(),
Sentry.expressIntegration(),
],
debug: true,
beforeSend: (ev, hint) => {
console.log("Sentry sending ", { ev, hint })
return ev;
},
// Add Tracing by setting tracesSampleRate
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set sampling rate for profiling
// This is relative to tracesSampleRate
profilesSampleRate: 1.0,
environment: `test-local`
});
console.log("initialized Sentry for bundle");
-
instrument.js is being required at the top of the main file, in the beginning of the application
-
logs in ticket #152026
Expected Result
Sentry should initialize successfully and send events
Actual Result
Sentry does not initialize
Product Area
Ingestion and Filtering
Link
No response
DSN
No response
Version
No response
Assigning to @getsentry/support for routing ⏲️
Routing to @getsentry/product-owners-ingestion-and-filtering for triage ⏲️
@mydea i'm not sure if this is something for your team? It seems like got mislabeled and assigned to ingest instead.
Hey, this is a JS SDK issue, moving it to sentry-javascript!
If the content is bundled, they may need to configure things as external to work - instrumentation only works for external dependencies, not bundles one, as of now, sadly :/ So you'll need to make e.g. pg external. Can you try of that works?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀