You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AWS API Gateway stages are deployed as different API instances (no AWS stages are used) #2445
I'm not sure if this is by design, but one of the major differences between deploying 0.5.6 serverless functions and v1 is that AWS API Gateway names are prefixed with stage. AWS recommend creating generic API Gateway names, with multiple stages inside it. Image below shows how v1 deployment works:
0.5.6 version would deploy it within a single API, but have multiple stages inside it. This feels more correct, see below:
Is there a way to achieve this structure with v1?
Similarly, Lambda functions aren't versioned and Aliased the way they were in 0.5.6. Currently all function names are prefixed with a stage, which creates a large number of lambda functions. Is there a way to achieve function aliasing in the deploy process so that the API gateway references the correctly aliased function by setting the correct stage Variable like this:
Reacted by Ryan Pendergast, Timothy C, Chappo, Bastian Behrens, Noel Llevares, Mauricio Pereira, Andrew Munro, Leonardo Alifraco, ddernon, Davide Ungari and 61 more
Reacted by Bastian Behrens, Anthony, Matheus Borges Teixeira, Cameron Attard and Marcus Ekwall
Reacted by Eduardo Bortoluzzi Jr, Pim van Gurp, Marcus Ekwall and Coding Me
Due to the way that Cloudformation works and a lot of businesses that have multiple accounts for each environment so single API Gateway per stage allows for deploying and removing independently of each other. Also API Gateway is the only service that supports stages.
Reacted by rowan, Leonardo Alifraco, Mike Staub, NewGyu, Mark Stosberg, Slava Mednikov, Doug Moscrop, Karl Steltenpohl, Ville Seppänen, Ryan McGeary and 4 more
Reacted by Noel Llevares, ddernon, Ludovic, Ben Fitzgerald, Adam Mills, POANG1, Trevor, Alberto Rodríguez, Chris/0, Ricardo Mutti and 18 more
Still I believe stage and service tokens order in API name is indeed confusing, and doesn't seem right (not sure why it was decided to have {stage}-{service} instead of {service}-{stage} as in all other cases) for that issue please track #2918
changed the title [-]AWS API Gateway stages and names are separated[/-][+]AWS API Gateway stages are deployed as different API instances (no AWS stages are used)[/+]on Aug 19, 2020
For those coming to this ticket in 2021 looking for answers, it looks like V3 of serverless will implement API gateway naming as ${service}-${stage} as many have asked for. You can adopt this now with a config setting.
it looks like V3 of serverless will implement API gateway naming as ${service}-${stage} as many have asked for. You can adopt this now with a config setting.
We actually decided to revert from that, as migration from already deployed API gateway requires API to be removed and re-created, and also we'd rather push users to migrate to HTTP API instead. Still the setting will remain working.
Activity
hereandnow commentedon Oct 20, 2016
I wanted to open excactly the same Issue. APIG has the concept of Stages, we really should use that!
i tried to overwrite the name in the serverless.yml file:
didnt work. the
cloudformation-template-create-stack.jsoncreated has that name:the
cloudformation-template-update-stack.jsonnot ;-(at least that workaround should do!
leonardoalifraco commentedon Nov 1, 2016
This is happening to me too. Is this by design?
andymac4182 commentedon Nov 1, 2016
This is by design. @leonardoalifraco
Due to the way that Cloudformation works and a lot of businesses that have multiple accounts for each environment so single API Gateway per stage allows for deploying and removing independently of each other. Also API Gateway is the only service that supports stages.
leonardoalifraco commentedon Nov 1, 2016
Makes sense. Thanks!
andymac4182 commentedon Nov 2, 2016
@dashmug Is there anything else I can cover to help explain this?
dashmug commentedon Nov 2, 2016
@andymac4182
I'm sure you guys have thought this through but it's not very clear to me yet.
What's the problem with the way serverless v0.5.6 does it (using API Gateway's "Stages") versus version 1's one-stage, one-gateway approach?
31 remaining items
michelem09 commentedon Mar 19, 2020
So we are on 2020 and this issue is still open, is there a way to have every stages under the same API?
Thanks
cldsnchz commentedon May 30, 2020
Sorry if this is off-topic but I guess it is somehow related.
Currently the provider stage is also used to configure the APIG stage name
Is there any way to customize the APIG stage name?, something like having:
I would like to configure the stages dev, test, etc but all of them with v1 as APIG stage name, but I haven't found a way to do that.
tomaszdudek7 commentedon Aug 3, 2020
@michelem09 Duh, we're closer to 2021 now.
@cldsnchz (How) did you solve it? It has been a few months. :)
medikoo commentedon Aug 19, 2020
Closing, for reasons listed here: #2445 (comment)
Still I believe stage and service tokens order in API name is indeed confusing, and doesn't seem right (not sure why it was decided to have
{stage}-{service}instead of{service}-{stage}as in all other cases) for that issue please track #2918[-]AWS API Gateway stages and names are separated[/-][+]AWS API Gateway stages are deployed as different API instances (no AWS stages are used)[/+]sc0ttdav3y commentedon Apr 28, 2021
For those coming to this ticket in 2021 looking for answers, it looks like V3 of serverless will implement API gateway naming as
${service}-${stage}as many have asked for. You can adopt this now with a config setting.https://www.serverless.com/framework/docs/deprecations#api-gateway-naming-will-be-changed-to-service-stage
medikoo commentedon Apr 28, 2021
We actually decided to revert from that, as migration from already deployed API gateway requires API to be removed and re-created, and also we'd rather push users to migrate to HTTP API instead. Still the setting will remain working.
Reference: #9160 (comment)
sc0ttdav3y commentedon Apr 28, 2021
Thanks for the response @medikoo.
I’m only 1 week in as a serverless dev, so here are my take-aways:
shouldStartNameWithServicesetting works, will still be supported and gives me a consistent name that doesn’t grate my type-A personality 🎉httpAPII didn’t know about
httpAPI— all the getting started recipes and tutorials I’ve come across talk abouthttp.Thanks again for following up.