-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda functions break when instrumenting with Datadog Layers when using NODEJS_LATEST runtime #314
Comments
@maherio Thanks for reporting. Could you share more of this code
For example, what other params are you passing? Are you setting a bundling image? |
Could you also provide:
Thanks! |
Hi, I can chime in with some more info here. This is caused by aws/aws-cdk#30108, which was introduced in cdk version 2.146.0. When using |
@cgatt Thanks for the info! Let me try to reproduce it. |
@cgatt Could you share your code for setting the runtime? I'm unable to reproduce the issue using:
This is because |
Hi @lym953, This will only take effect from aws-cdk-lib version |
Hi @lym953, import { determineLatestNodeRuntime, InlineCode } from 'aws-cdk-lib/aws-lambda';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { App, Stack } from 'aws-cdk-lib';
import { Datadog } from 'datadog-cdk-constructs-v2';
const app = new App();
const stack = new Stack(app, 'TestStack');
const lambda = new NodejsFunction(stack, 'MyLambda', {
runtime: determineLatestNodeRuntime(this),
code: InlineCode.fromInline("module.exports.handler = (event) => { console.log('Event received: ', JSON.stringify(event)); }"),
handler: 'index.handler',
});
const datadog = new Datadog(stack, 'Datadog', {
nodeLayerVersion: 115,
extensionLayerVersion: 63,
enableDatadogASM: true, // This causes AWS_LAMBDA_EXEC_WRAPPER to be set even if adding layers fails
apiKey: 'foo',
});
datadog.addLambdaFunctions([lambda]);
app.synth(); I've not been able to recreate the behaviour with Runtime.NODEJS_LATEST, though theoretically any stack structure that results in the runtime being a token could cause this. |
@cgatt Thanks for the additional info! I was able to reproduce it. Working on a fix. |
For the short term, I'm going to make CDK Construct skip instrumenting the Lambda function to avoid runtime error. cc PM @sumedham to track this feature request. |
Expected Behavior
I can create a Lambda function using
Runtime.NODEJS_LATEST
and instrument it with Datadog layers.Or at the very least, my function is not instrumented at all and can still successfully execute.
Actual Behavior
Unsupported runtime: ${Token[TOKEN.1308]}
)./opt/datadog_wrapper: does not exist
).Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: