File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/node/src/integrations/tracing/hapi Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ import { isWrapped } from '@opentelemetry/core' ;
12import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi' ;
23import {
34 SDK_VERSION ,
@@ -11,7 +12,7 @@ import {
1112} from '@sentry/core' ;
1213import { addOpenTelemetryInstrumentation } from '@sentry/opentelemetry' ;
1314import type { IntegrationFn } from '@sentry/types' ;
14- import { logger } from '@sentry/utils' ;
15+ import { consoleSandbox , logger } from '@sentry/utils' ;
1516import { DEBUG_BUILD } from '../../../debug-build' ;
1617import type { Boom , RequestEvent , ResponseObject , Server } from './types' ;
1718
@@ -92,4 +93,14 @@ export const hapiErrorPlugin = {
9293 */
9394export async function setupHapiErrorHandler ( server : Server ) : Promise < void > {
9495 await server . register ( hapiErrorPlugin ) ;
96+
97+ // eslint-disable-next-line @typescript-eslint/unbound-method
98+ if ( ! isWrapped ( server . register ) ) {
99+ consoleSandbox ( ( ) => {
100+ // eslint-disable-next-line no-console
101+ console . warn (
102+ '[Sentry] Hapi is not instrumented. This is likely because you required/imported hapi before calling `Sentry.init()`.' ,
103+ ) ;
104+ } ) ;
105+ }
95106}
You can’t perform that action at this time.
0 commit comments