AWS Lambda中的空白环境变量

时间:2018-05-28 06:23:58

标签: c# .net amazon-web-services aws-lambda

我已经在我的AWS Lambda中定义了几个环境变量,但是当我尝试在我的.Net代码中访问它们时,它们是空白的。我错过了什么?

源代码:

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显示空白环境变量: had the same issue a couple of years ago and it was posted on the Apple forums

Lambda函数配置显示已配置的环境变量: enter image description here

1 个答案:

答案 0 :(得分:3)

您已在标记部分中指定了环境变量,因此出现了问题。您必须在“环境变量”部分中指定变量。