0
votes

I want to create API Gateway connected to Lambda function with Alias, I have IntegrationRouteTargetProvider which is providing integration routes to the API. I got the URI from the lambda so I think it is correct. Also I checked number of SO questions and also in the documentation is arn:aws:apigateway:{region}:{subdomain.service|service}:path|action/{service_api}.

My uri is

arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:051069080387:function:deploy-test-4-lambda/invocations.

However when I'm trying to create the api I get error:

Unable to put integration on 'ANY' for resource at path '/': Integrations of type 'AWS_PROXY' currently only supports Lambda function and Firehose stream invocations.

Here is my IntegrationRouteTargetProvider:

export class AliasLambdaProvider implements IntegrationRouteTargetProvider {
    target(name: string, parent: pulumi.Resource): pulumi.Input<IntegrationTarget> {
        return {
            type: "aws_proxy",
            uri: 'arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:051069080387:function:deploy-test-4-lambda/invocations',
        };
    }
}

and than using it when creating API

return new API(name, {
        routes: [
            {
                path: "/",
                target: new AliasLambdaProvider()
            }
        ],
        stageName: name + "-stage"
    }, { provider });
1

1 Answers

0
votes

You're using:

type: "aws_proxy"

Which means everything is passed to the lambda and headers need to be handled at the lambda. Integration is disabled for AWS_Proxy type, thus the error. However, if you wanted to define integration methods/mapping templates etc, use:

type: "aws"