File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
packages/instrumentation-sentry-node/src Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @hyperdx/instrumentation-sentry-node ' : patch
3+ ' @hyperdx/node-opentelemetry ' : patch
4+ ---
5+
6+ fix: check if addIntegration method exists
Original file line number Diff line number Diff line change @@ -35,9 +35,19 @@ export class SentryNodeInstrumentation extends InstrumentationBase {
3535 this . _wrap ( moduleExports , 'init' , ( original : any ) => {
3636 return ( ...args : any [ ] ) => {
3737 const result = original . apply ( this , args ) ;
38- // WARNING: we need to add the integration once the SDK is initialized
39- moduleExports . addIntegration ( hyperdxIntegration ( ) ) ;
40- diag . debug ( 'Added HyperDX Sentry integration.' ) ;
38+ try {
39+ if ( moduleExports . addIntegration instanceof Function ) {
40+ // WARNING: we need to add the integration once the SDK is initialized
41+ moduleExports . addIntegration ( hyperdxIntegration ( ) ) ;
42+ diag . debug ( 'Added HyperDX Sentry integration' ) ;
43+ } else {
44+ diag . error (
45+ 'Sentry SDK does not support addIntegration method' ,
46+ ) ;
47+ }
48+ } catch ( e ) {
49+ diag . error ( 'Error adding HyperDX Sentry integration' , e ) ;
50+ }
4151 return result ;
4252 } ;
4353 } ) ;
You can’t perform that action at this time.
0 commit comments