API Gateway REST 未遵守 Lambda 别名

0

【以下的问题经过翻译处理】 我已经将我的API Gateway REST资源连接到一个Lambda函数。当我在REST资源的"Integration Request"页面的"Lambda Function"字段中只使用Lambda函数的名称(而不是别名或版本)时,它可以正常工作。然而,当我给我的Lambda函数添加一个别名,并将"Lambda Function"设置为使用Lambda函数末尾的":alias",然后在Lambda别名上设置正确的权限后,请求无法通过。

我从其中一个请求中获取了来自API Gateway的CloudWatch日志。以下是相关部分:

(57980943-e0ee-4556-a70d-477ea10f0b43) Sending request to https://lambda.us-west-2.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-west-2:**************:function:interact/invocations
(57980943-e0ee-4556-a70d-477ea10f0b43) Execution failed due to configuration error: Invalid permissions on Lambda function

您可以看到API Gateway试图将请求发送到未使用别名的函数名称,而不是别名版本。我只在别名函数上具有LambdaInvoke权限,而不是未使用别名的函数,因此错误消息是合理的。令人困惑的是,为什么ApiGateway没有使用我在资源的"Integration Request"页面中指定的别名。

有人可以帮忙解释一下吗?

1 Risposta
0

【以下的回答经过翻译处理】 我找到了解决方法。在您的API Gateway的"Resources"页面中,即使看起来UI中的更改已经生效,您仍需要点击"Actions" -> "Deploy API",以使任何API更改生效。问题是我的API更改未部署,并且没有任何视觉指示表明我有未部署的待处理更改。部署API可以解决这个问题。

profile picture
ESPERTO
con risposta 5 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande