Help us improve the AWS re:Post Knowledge Center by sharing your feedback in a brief survey. Your input can influence how we create and update our content to better support your AWS journey.
我使用階段變數在 API Gateway 中定義我的 Lambda 整合。為什麼當我調用 API 方法時,會收到 "Internal server error (內部伺服器錯誤)" 和 500 狀態碼?
2 分的閱讀內容
0
我設定了 Amazon API Gateway API 以使用階段變數調用 AWS Lambda 函數。當我調用 API 方法時,API 傳回 "Internal server error (內部伺服器錯誤)" 和 500 狀態碼。如何解決此錯誤?
簡短說明
如果您 Lambda 函數的資源型政策不包含 API 調用函數的許可,API Gateway 會傳回 Internal server error (內部伺服器錯誤) 訊息。
在 arn:aws:execute-api:region:account-id:api-id/*/GET/lambdasv1,輸入調用您函數的 API Gateway 資源 ARN。如需 HTTP API 和 REST API 的 ARN 格式,請參閱](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html#api-gateway-iam-policy-resource-format-for-executing-api)在 API Gateway 中執行 API 之許可的資源格式[。如需 WebSocket API 的 ARN 格式,請參閱使用 IAM 授權。