Working on a serverless project that includes a lambda@edge trigger.
Lambda@edge functions do not allow setting any environment variables. In my project, I need lambda functions and labda@edge functions to co-exist. However I have some global environment variables that are set in the environment section of my serverless.yml file. This causes an error on deploy:
An error occurred: CloudFrontDistribution - The function cannot have environment variables. Function: arn:aws:lambda:us-east-1:973909360769:function:designstripe-dev-cfLambda:3 (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidLambdaFunctionAssociation; Request ID: 9968b538-7d9e-49d2-9a8c-91f99291db54).
My functions are packaged individually, and because of that, every function has the globally defined environment variables set. I could, in order to get around the issue, set variables per function, but I have many of them and it would just bloat the config file.
Is there any way that one can unset environment variable definitions for a specific function?