aws / aws-lambda-base-images

Apache License 2.0
671 stars 110 forks source link

Wrong value in AWS_EXECUTION_ENV when read from AWS_LAMBDA_EXEC_WRAPPER #15

Closed Oberon00 closed 3 years ago

Oberon00 commented 3 years ago

Hello! I observed that when printing the environment variable AWS_EXECUTION_ENVfrom an AWS_LAMBDA_EXEC_WRAPPER script in the java8.al2 or java11 base image is not set at all when run locally using docker run and is set to an undocumented value AWS_Lambda_Image when the image is actually deployed to AWS and executed as Lambda.

Funnily enough, I observed the same behavior (checked only locally so far) with the Python base image version 3.8.2021.05.14.10 but not the immediately next version 3.8.2021.05.17.10 ony any version thereafter that I checked. Did you fix that there recently?

Since there are no release notes anywhere (I can find) it's hard to say which images are affected.

I more or less randomly checked a few versions, as follows (entry is the value obtained when running the image with docker run --entrypoint env):

Lang Version local (entry) local (execwrapper) AWS (execwrapper)
python 3.8.2021.05.14.10 (not set) (not set) ?
3.8.2021.05.17.10 (that's right next after 05.17 above) (not set) AWS_Lambda_python3.8 ?
3.8.2021.05.20.07 (not set) AWS_Lambda_python3.8 AWS_Lambda_python3.8
java 8.al2.2021.05.17.11 (not set) (not set) AWS_Lambda_Image
8.al2.2021.05.20.08 (not set) (not set) ?
11.2021.05.20.07 (not set) (not set) ?
nodejs 14.2021.05.18.12 (not set) AWS_Lambda_nodejs14.x AWS_Lambda_nodejs14.x

When reading AWS_EXECUTION_ENV from the actual Lambda in Java (i.e. from inside the JVM), the value seems to be correct though. But this is not enough when you want to do something in the execwrapper script based on AWS_EXECUTION_ENV.

Documentation:

carlzogh commented 3 years ago

Hey @Oberon00, thanks for reaching out!

We have since fixed this issue and deployed it as part of:

AWS_EXECUTION_ENV should now have the right values in the scope of the exec wrapper.

Oberon00 commented 3 years ago

Thank you very much for the quick resolution!