Skip to content

Commit bf60640

Browse files
nicohrubecclaude
andauthored
feat(aws-serverless)!: Remove unused startTrace option and tryPatchHandler (#23219)
Removes two deprecated, unused parts of the `@sentry/aws-serverless` public API: - The `startTrace` option on `wrapHandler` — it had no effect (to disable tracing, set `tracesSampleRate` to `0`). - The `tryPatchHandler` function. Both are already documented in `docs/migration/v11-end-state.md`. Fixes #22252 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d0586a1 commit bf60640

2 files changed

Lines changed: 2 additions & 31 deletions

File tree

‎packages/aws-serverless/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,5 @@ export { awsLambdaIntegration } from './integration/awslambda';
176176

177177
export { getDefaultIntegrations, init } from './init';
178178
// eslint-disable-next-line typescript/no-deprecated
179-
export { tryPatchHandler, wrapHandler } from './sdk';
179+
export { wrapHandler } from './sdk';
180180
export type { WrapperOptions } from './sdk';

‎packages/aws-serverless/src/sdk.ts‎

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Scope } from '@sentry/core';
2-
import { consoleSandbox, debug } from '@sentry/core';
2+
import { debug } from '@sentry/core';
33
import { captureException, captureMessage, flush, getCurrentScope, withScope } from '@sentry/node';
44
import type { Context, Handler, StreamifyHandler } from 'aws-lambda';
55
import { performance } from 'perf_hooks';
@@ -32,12 +32,6 @@ export interface WrapperOptions {
3232
* @default false
3333
*/
3434
captureAllSettledReasons: boolean;
35-
// TODO(v11): Remove this option since its no longer used.
36-
/**
37-
* @deprecated This option has no effect and will be removed in a future major version.
38-
* If you want to disable tracing, set `SENTRY_TRACES_SAMPLE_RATE` to `0.0`, otherwise OpenTelemetry will automatically trace the handler.
39-
*/
40-
startTrace: boolean;
4135
}
4236

4337
/** */
@@ -61,17 +55,6 @@ function getRejectedReasons<T>(results: PromiseSettledResult<T>[]): T[] {
6155
}, []);
6256
}
6357

64-
/**
65-
* TODO(v11): Remove this function
66-
* @deprecated This function is no longer used and will be removed in a future major version.
67-
*/
68-
export function tryPatchHandler(_taskRoot: string, _handlerPath: string): void {
69-
consoleSandbox(() => {
70-
// eslint-disable-next-line no-console
71-
console.warn('The `tryPatchHandler` function is deprecated and will be removed in a future major version.');
72-
});
73-
}
74-
7558
/**
7659
* Tries to invoke context.getRemainingTimeInMillis if not available returns 0
7760
* Some environments use AWS lambda but don't support this function
@@ -168,24 +151,12 @@ export function wrapHandler<TEvent, TResult>(
168151
): Handler<TEvent, TResult> | StreamifyHandler<TEvent, TResult> {
169152
const START_TIME = performance.now();
170153

171-
// eslint-disable-next-line typescript/no-deprecated
172-
if (typeof wrapOptions.startTrace !== 'undefined') {
173-
consoleSandbox(() => {
174-
// eslint-disable-next-line no-console
175-
console.warn(
176-
'The `startTrace` option is deprecated and will be removed in a future major version. If you want to disable tracing, set `SENTRY_TRACES_SAMPLE_RATE` to `0.0`.',
177-
);
178-
});
179-
}
180-
181154
const options: WrapperOptions = {
182155
flushTimeout: 2000,
183156
callbackWaitsForEmptyEventLoop: false,
184157
captureTimeoutWarning: true,
185158
timeoutWarningLimit: 500,
186159
captureAllSettledReasons: false,
187-
// oxlint-disable-next-line typescript/no-deprecated -- set only to satisfy the type; see the TODO below
188-
startTrace: true, // TODO(v11): Remove this option. Set to true here to satisfy the type, but has no effect.
189160
...wrapOptions,
190161
};
191162

0 commit comments

Comments
 (0)