DataDog / datadog-cloudformation-macro

CloudFormation Macros by Datadog
Apache License 2.0
14 stars 22 forks source link

DD_LAMBDA_HANDLER value is set incorrectly after sam deploy #73

Closed darin-holloway closed 2 years ago

darin-holloway commented 2 years ago

Expected Behavior

DD_LAMBDA_HANDLER value matches what is in our template.yaml

Actual Behavior

DD_LAMBDA_HANDLER is set to datadog_lambda.handler.handler, causing the lambda to not run due to a cyclical dependency

Steps to Reproduce the Problem

  1. Add DatadogServerless transform to your template.yaml pythonLayerVersion: 62 extensionLayerVersion: 28
  2. Set DD_LAMBDA_HANDER to our app's app.lambda_handler
  3. Set Handler for lambda to datadog_lambda.handler.handler
  4. sam deploy
  5. observe that the value for DD_LAMBDA_HANDLER is incorrect leading to invocation errors

Specifications

For the Datadog Serverless Macro:

Stacktrace

  Paste here
darin-holloway commented 2 years ago

after seeing that 0.5.0 had been released, I upgraded to it and deployed my app again and didn't see this behavior.

darin-holloway commented 2 years ago

Might have spoke too soon, now seeing this behavior re-appear

darin-holloway commented 2 years ago

behavior was also observed with a nodejs 16 application

tianchu commented 2 years ago

I believe the macro automatically update the handler and DD_LAMBDA_HANDLER env var. So steps 2 & 3 in your reproduction steps are unnecessary. Could that be the cause of the issue?

tianchu commented 2 years ago

https://docs.datadoghq.com/serverless/installation/python?tab=awssam has the step by step instructions in case it's helpful.

darin-holloway commented 2 years ago

@tianchu thank you, going to test with DD_LAMBDA_HANDLER unset to confirm if the transform does to job for us

darin-holloway commented 2 years ago

Confirmed working correctly now, thanks for the tip