-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Tracer Version(s)
.> 5.51.0
Node.js Version(s)
22.x
Bug Report
Hi There,
We are using the dd-cdk-constructs-v2 library with some custom auto-instrumentation, and noticed that using Node Lambda Layer >= 126 (which ships dd-trace-js@5.56.0) crashes our authorizers on the start of an invocation.
(See cloudwatch extract in the error logs)
This behaviour doesn't occur in layer 125, so I assume the change went in between 5.51 and 5.56.
Based on my analysis, Lambda Authorizers don't include the context object as a second argument to the lambda handler, so when the tracer fails to find this argument, it throws an error instead of logging or just dealing with it.
This is undesirable, as it limits the default lambda layer version we can set in our internal library, so we miss out on all the newer features for most users.
Reproduction Code
// src/lambda/authorizer/handler/index.ts
import type { APIGatewayAuthorizerWithContextResult, APIGatewayRequestAuthorizerEvent } from 'aws-lambda';
export const handler = async (
event: APIGatewayRequestAuthorizerEvent
): Promise<APIGatewayAuthorizerWithContextResult<any>> => {
console.log('Hello World');
// This is bad but illustrates the point
return {
principalId: '*',
policyDocument: {
Version: '2012-10-17',
Statement: [
{
Action: 'execute-api:Invoke',
Effect: 'Allow,
Resource: ['*'],
},
],
},
};
};Error Logs
Tracer Config
N/A
Operating System
Amazon Linux 2
Bundling
ESBuild