Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

amazon web services - Why does AWS keep saying my ARN is invalid?

I'm trying to deploy an API Gateway with Lambda integration and I can't get around one particular error. I've checked some posts that took about making sure you've followed the request format, which I believe I have. The error I keep receiving is:

Invalid ARN specified in the request: Integrations of type 'AWS_PROXY' currently only supports Lambda function and Firehose stream invocations (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException;

This is what my CloudFormation looks like:

Parameters:
EnvType:
    Type: String
    Default: "dev"

Resources:
    routerLambda:
            Type: AWS::Lambda::Function
            Properties:
                 FunctionName: !Sub router-${EnvType}
                 ...

    routerLambdaIntegration:
            Type: AWS::ApiGatewayV2::Integration
            Properties:
                ApiId: !Ref apiGateway
                IntegrationType: AWS_PROXY
                IntegrationUri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:router-dev/invocation"
            DependsOn: routerLambda

Can anyone see what I'm missing?

question from:https://stackoverflow.com/questions/65841664/why-does-aws-keep-saying-my-arn-is-invalid

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is a small typo in the URI, you have invocation instead of invocations

it should be

    Target: arn:aws:apigateway:{region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{region}:{account-id}:function:{function-name}/invocations

but you have

  IntegrationUri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:router-dev/invocation"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...