1
votes

I have defined several environment variables in my AWS Lambda but when I try and access them in my .Net code they are coming in as blank.What am I missing?

Source Code:

public void CalculateInterimReviewsToBeCreated(Input input, ILambdaContext context)
{
    var uri = new Uri(getFSRHistoryURL);
    using (var httpClient = new HttpClient { BaseAddress = uri })
    {
        var authenticationHeaderKey = System.Environment.GetEnvironmentVariable("AuthenticationHeaderKey");
        LambdaLogger.Log("CalculateInterimReviewsToBeCreated : authenticationHeaderKey" + authenticationHeaderKey);
        ...
    }
    ...
}

CloudWatch shows blank environment variable: enter image description here

Lambda function configuration shows configured environment variable: enter image description here

1

1 Answers

3
votes

You have specified Environment Variables in the tag section and hence the problem. You have to specify variables in the Environment Variable section.