Skip to content

Commit 59f0dae

Browse files
committed
test: remove duplicate test handlers and invalid callback pattern
- Remove duplicate callbackstringerror handler (same as stringerror) - Remove callbackStringError test (strings are not valid for Lambda callbacks) - Update test to use stringerror instead of callbackstringerror
1 parent ae73486 commit 59f0dae

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

packages/instrumentation-aws-lambda/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* **instrumentation-aws-lambda:** Added runtime-aware handler support. The instrumentation automatically detects the Node.js runtime version from `AWS_EXECUTION_ENV` and adapts handler signatures accordingly:
99
- **Node.js 24+**: Only Promise-based handlers are supported (callbacks deprecated by AWS Lambda)
1010
- **Node.js 22 and lower**: Both callback-based and Promise-based handlers are supported for backward compatibility
11-
This ensures seamless operation across different Node.js runtime versions while respecting AWS Lambda's deprecation of callbacks in Node.js 24+.
11+
This ensures seamless operation across different Node.js runtime versions while respecting AWS Lambda's removal of callbacks in Node.js 24+.
1212

1313
## [0.60.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-lambda-v0.60.0...instrumentation-aws-lambda-v0.60.1) (2025-11-24)
1414

packages/instrumentation-aws-lambda/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentelemetry/instrumentation-aws-lambda",
3-
"version": "0.61.0",
3+
"version": "0.60.1",
44
"description": "OpenTelemetry instrumentation for AWS Lambda function invocations",
55
"main": "build/src/index.js",
66
"types": "build/src/index.d.ts",

packages/instrumentation-aws-lambda/src/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ export class AwsLambdaInstrumentation extends InstrumentationBase<AwsLambdaInstr
520520
private _wrapCallback(original: Callback, span: Span): Callback {
521521
const plugin = this;
522522
return function wrappedCallback(this: never, err, res) {
523-
diag.debug('AWS Lambda instrumentation: Executing wrapped callback function');
523+
plugin._diag.debug('executing wrapped callback function');
524524
plugin._applyResponseHook(span, err, res);
525525

526526
plugin._endSpan(span, err, () => {
527-
diag.debug('AWS Lambda instrumentation: Executing original callback function');
527+
plugin._diag.debug('executing original callback function');
528528
return original.apply(this, [err, res]);
529529
});
530530
};

packages/instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,11 @@ describe('lambda handler', () => {
376376
});
377377

378378
it('should record string error in promise rejection', async () => {
379-
initializeHandler('lambda-test/sync.callbackstringerror');
379+
initializeHandler('lambda-test/sync.stringerror');
380380

381381
let err: string;
382382
try {
383-
await lambdaRequire('lambda-test/sync').callbackstringerror('arg', ctx);
383+
await lambdaRequire('lambda-test/sync').stringerror('arg', ctx);
384384
} catch (e: any) {
385385
err = e;
386386
}

packages/instrumentation-aws-lambda/test/lambda-test/sync.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ exports.stringerror = async function (event, context) {
3232
throw 'handler error';
3333
};
3434

35-
exports.callbackstringerror = async function (event, context) {
36-
throw 'handler error';
37-
};
38-
3935
exports.context = async function (event, context) {
4036
return api.trace.getSpan(api.context.active()).spanContext().traceId;
4137
};

0 commit comments

Comments
 (0)