gpt4 book ai didi

amazon-web-services - API Gateway CreateAuthorizer 因 InternalFailure 失败

转载 作者:行者123 更新时间:2023-12-03 07:45:33 32 4
gpt4 key购买 nike

当我尝试使用 CloudFormation 为我的 AWS API Gateway 创建自定义授权者时,它在尝试执行 CreateAuthorizer 调用时一直卡住,但失败。这是我可以重现该行为的最小 CloudFormation 模板:

AWSTemplateFormatVersion: "2010-09-09"
Resources:
ApiGatewayV1:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "test"

ApiAuthorizerV1:
Type: "AWS::ApiGateway::Authorizer"
Properties:
RestApiId: !Ref "ApiGatewayV1"
Name: "test"
Type: "TOKEN"
AuthorizerUri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda::${AWS::AccountId}:function:${!stageVariables.AuthorizerLambdaName}/invocations"
IdentitySource: "method.request.header.Authorization"
AuthorizerResultTtlInSeconds: 3600

CloudTrail日志:

"errorCode": "InternalFailure",
"errorMessage": "An unknown error occurred",
"requestParameters": {
"restApiId": "lweme6j3wk",
"createAuthorizerInput": {
"providerARNs": [],
"identitySource": "method.request.header.Authorization",
"authorizerResultTtlInSeconds": 3600,
"type": "TOKEN",
"name": "test",
"authorizerUri": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda::<ACCOUNT_ID>:function:${stageVariables.AuthorizerLambdaName}/invocations"
},
"template": false
},
"responseElements": null,
"requestID": "470e2efa-d3c1-11e7-b0cc-b7fd2383ef6b",
"eventID": "2ceccaa5-9b97-4b1e-93e5-3c4e6bca419d",

最佳答案

好吧,晚餐真是太奇怪了。当我在目标 lambda ARN 中明确指定区域时,它起作用了!

替换:

arn:aws:lambda::<ACCOUNT_ID>

与:

arn:aws:lambda:<REGION>:<ACCOUNT_ID>

(是的,它与 ${AWS::Region}:${AWS::AccountId} 占位符一起使用,我使用固定值进行检查。

关于amazon-web-services - API Gateway CreateAuthorizer 因 InternalFailure 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47521422/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com