【发布时间】:2020-01-26 20:16:33
【问题描述】:
我正在尝试使用 SAM 为我的 Lambda 函数设置本地开发环境。在我在配置中添加对层的引用之前,一切正常。
我按照此处的说明操作:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-layers.html。我在我的 template.ymal 中为我的层版本添加了我的 ARN,如下所示:
# template.ymal
TestLayerFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: TestLayer
Role: arn:aws:iam::111111111111:role/ReadStreamingTable
CodeUri: src/streaming/test-layer/
Handler: app.handler
Runtime: nodejs8.10
Layers:
- arn:aws:lambda:eu-west-1:111111111111:layer:Global:7
但是,当运行“sam local invoke”时,出现以下错误:
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL:
"https://lambda.eu-west-1a.amazonaws.com/2018-10-31/layers/arn%3Aaws%3Alambda%3Aeu-west-1%3A111111111111%3Alayer%3AGlobal/versions/7"
我在配置中添加层 ARN 的方式似乎正是他们在示例中的操作方式,所以我不确定是什么导致了错误。
【问题讨论】:
-
我看到您的问题已经两个月没有得到解答,这并没有给我太大希望,因为我遇到了几乎相同的问题,尽管我正在尝试同时创建图层时间,不要使用已经部署的。我不知道这是否对您的问题有帮助,但您是否尝试过将
--layer-cache-basedir参数与sam invoke local一起使用?
标签: amazon-web-services aws-lambda aws-cli aws-sam