When I am running my AWS Typescript lambda with ESM I get the following warning: You cannot annotate the main segment in a Lambda execution environment
. Am not sure only what the cause could be since I wasnt able to find a lot of information online about it.
My handler looks something like this:
class Lambda implements LambdaInterface {
private readonly targetService= new TargetService();
@logger.injectLambdaContext({ logEvent: true })
@catchError({ tracer: tracer })
public async handler(event: APIGatewayProxyEvent, context: Context): Promise<APIGatewayProxyStructuredResultV2> {
...
}
}
const handlerClass = new Lambda();
export const handler = handlerClass.handler.bind(handlerClass);
Could someone maybe explain what this warning means and where I should look to solve said issue?