Skip to content

Installing multiple stages results in multiple APIs #17

@paulbutcher

Description

@paulbutcher

I'm not sure whether this is me misunderstanding things (it may well be), but I was expecting that if I had production and test stages defined in my project.clj, this would create a single API with two different stages. But what I see instead are two different APIs (with the same name). Am I misunderstanding?

To make this concrete, here is the relevant section of my project.clj:

  :lambda {"test" [{:api-gateway {:name "RotaApi"}
                    :handler "rota-api.core.MyLambdaFn"
                    :memory-size 512
                    :timeout 60
                    :function-name "rota-api-test"}]
           "production" [{:api-gateway {:name "RotaApi"}
                          :handler "rota-api.core.MyLambdaFn"
                          :memory-size 512
                          :timeout 60
                          :function-name "rota-api"}]}

Running lein lambda install test gives me:

Setting up API Gateway with api name RotaApi
Creating role api-gateway-role-saug2l89q6 with policy api-gateway-role-policy-saug2l89q6 and statements {:Version 2012-10-17, :Statement [{:Effect Allow, :Action [lambda:InvokeFunction], :Resource [arn:aws:lambda:eu-west-1:221985399864:function:rota-api-test]}]}
Creating integration with role-arn arn:aws:iam::221985399864:role/api-gateway-role-saug2l89q6
Deployed to https://saug2l89q6.execute-api.eu-west-1.amazonaws.com/test

And then lein lambda install production gives me:

Setting up API Gateway with api name RotaApi
Creating role api-gateway-role-6od4rpb94g with policy api-gateway-role-policy-6od4rpb94g and statements {:Version 2012-10-17, :Statement [{:Effect Allow, :Action [lambda:InvokeFunction], :Resource [arn:aws:lambda:eu-west-1:221985399864:function:rota-api]}]}
Creating integration with role-arn arn:aws:iam::221985399864:role/api-gateway-role-6od4rpb94g
Deployed to https://6od4rpb94g.execute-api.eu-west-1.amazonaws.com/production

Sure enough, when I look in the API Gateway web console, I can see that I have two APIs, both called "RotaApi".

Is this intended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions