Open klingenm opened 2 months ago
Found another thing related to image based lambdas. You prepend the "LAMBDA_TASK_ROOT" to the "handler" when including it. We have a common image where we are bundling code for many lambdas, so we don't set the env var in the image (instead we set the working directory in the lambda image config), and it is reserved, so it can be set in the configuration. Found a workaround for this as well, by setting the "DD_LAMBDA_HANDLER" to a full path /full/path/to/the/file.handler
. Not sure if it falls under the same image lambda pitfalls umbrella.
Expected Behavior
The following code;
should work (or break).
Actual Behavior
The
DD_LAMBDA_HANDLER
environment variable is forcibly overridden with the value of the function defaultChild.handler, which for a container lambda function isundefined
(and has to be ´undefined`).Synth and deploy works, but the DD_LAMBDA_HANDLER env variable has disappeared, so function cant run.
https://github.com/DataDog/datadog-cdk-constructs/blob/0e1d841f7a4537b61ac7205ae7936fc9ccce5bac/src/redirect.ts#L48
From reading the code I could figure out that I should disable the redirect. But it was quite hard to find out.
There is documentation for how to use CDK and how to install the extension in a container but not how to combine the two.
I would expect that doing what I did should cause error on synth, or the redirect would be disabled by default if function is configure with image (
func.runtime.runtimeEquals(Runtime.FROM_IMAGE
).Good thing you keep this open source, so one can figure out what's happening :D
Steps to Reproduce the Problem
Specifications