|
9 | 9 | getIsolationScope,
|
10 | 10 | spanToJSON,
|
11 | 11 | } from '@sentry/core';
|
12 |
| -import type { IntegrationFn, Span } from '@sentry/types'; |
13 |
| -import { logger } from '@sentry/utils'; |
| 12 | +import type { Span } from '@sentry/types'; |
| 13 | +import { consoleSandbox, logger } from '@sentry/utils'; |
14 | 14 | import { generateInstrumentOnce } from '../../../otel/instrument';
|
15 | 15 | import { SentryNestEventInstrumentation } from './sentry-nest-event-instrumentation';
|
16 | 16 | import { SentryNestInstrumentation } from './sentry-nest-instrumentation';
|
@@ -39,26 +39,35 @@ export const instrumentNest = Object.assign(
|
39 | 39 | { id: INTEGRATION_NAME },
|
40 | 40 | );
|
41 | 41 |
|
42 |
| -const _nestIntegration = (() => { |
| 42 | +/** |
| 43 | + * Integration capturing tracing data for NestJS. |
| 44 | + * |
| 45 | + * @deprecated The `nestIntegration` is deprecated. Instead, use the NestJS SDK directly (`@sentry/nestjs`), or use the `nestIntegration` export from `@sentry/nestjs`. |
| 46 | + */ |
| 47 | +export const nestIntegration = defineIntegration(() => { |
43 | 48 | return {
|
44 | 49 | name: INTEGRATION_NAME,
|
45 | 50 | setupOnce() {
|
46 | 51 | instrumentNest();
|
47 | 52 | },
|
48 | 53 | };
|
49 |
| -}) satisfies IntegrationFn; |
50 |
| - |
51 |
| -/** |
52 |
| - * Nest framework integration |
53 |
| - * |
54 |
| - * Capture tracing data for nest. |
55 |
| - */ |
56 |
| -export const nestIntegration = defineIntegration(_nestIntegration); |
| 54 | +}); |
57 | 55 |
|
58 | 56 | /**
|
59 | 57 | * Setup an error handler for Nest.
|
| 58 | + * |
| 59 | + * @deprecated `setupNestErrorHandler` is deprecated. |
| 60 | + * Instead use the `@sentry/nestjs` package, which has more functional APIs for capturing errors. |
| 61 | + * See the [`@sentry/nestjs` Setup Guide](https://docs.sentry.io/platforms/javascript/guides/nestjs/) for how to set up the Sentry NestJS SDK. |
60 | 62 | */
|
61 | 63 | export function setupNestErrorHandler(app: MinimalNestJsApp, baseFilter: NestJsErrorFilter): void {
|
| 64 | + consoleSandbox(() => { |
| 65 | + // eslint-disable-next-line no-console |
| 66 | + console.warn( |
| 67 | + '[Sentry] Warning: You used the `setupNestErrorHandler()` method to set up Sentry error monitoring. This function is deprecated and will be removed in the next major version. Instead, it is recommended to use the `@sentry/nestjs` package. To set up the NestJS SDK see: https://docs.sentry.io/platforms/javascript/guides/nestjs/', |
| 68 | + ); |
| 69 | + }); |
| 70 | + |
62 | 71 | // Sadly, NestInstrumentation has no requestHook, so we need to add the attributes here
|
63 | 72 | // We register this hook in this method, because if we register it in the integration `setup`,
|
64 | 73 | // it would always run even for users that are not even using Nest.js
|
|
0 commit comments