INNER CODE UNIT · Python
check_envs
aws-powertools/powertools-lambda-python · layer_v3/layer/canary/app.py:73
def check_envs():
logger.info('Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]')
if not layer_arn:
raise ValueError("POWERTOOLS_LAYER_ARN is not set. Aborting...")
if not powertools_version:
raise ValueError("POWERTOOLS_VERSION is not set. Aborting...")
if not stage:
raise ValueError("LAYER_PIPELINE_STAGE is not set. Aborting...")
if not event_bus_arn:
raise ValueError("VERSION_TRACKING_EVENT_BUS_ARN is not set. Aborting...")
logger.info("All envs configured, continue...")
def verify_powertools_version() -> None:
"""
fetches the version that we import from the Powertools for AWS Lambda (Python) layer and compares
it with expected version set in environment variable, which we pass during deployment.
:raise ValueError if the expected version is not the same as the version we get from the layer