Apologies if this question has been asked before but I didn’t find anything on it.
I noticed that serverless deploys my functions to api gateway giving the stage name the same name as the stage in serverless config.
So if my stage is dev, the stage name is api gateway is dev also.
Is it possible to keep the api gateway stage name the same across all my environments and have different stage names in serverless?
Or is it possible to not have a stage at in api-gateway.
Following as I too am interested in this. I moved away from Serverless because of this exact issue.
Looking at the AWS API Gateway console. Stage is required to deploy(make available) your API gateway endpoints. So I can’t imagine there would be any way for Serverless to deploy without defining a stage as well.
Through the API Gateway console, you could set the Integration Request | Lambda Function value to point at a different function/version, but I don’t see a way to do that via serverless atm.
It might be possible but I don’t know anyone who has tried. The framework does allow you to overwrite defaults it uses by manually configuring resources in the resources section. Have a look at https://serverless.com/framework/docs/providers/aws/guide/resources/
ApiGateway::Deployment you need to override. The only problem I can see is that it uses a random number in the naming.
Thanks buggy & bfieber, I will be looking into this in the next couple days. and see what I can achieve with it. I will try to create my own apiGateway definition as buggy suggested.
Quick question, why does it need a random number in the naming? looking at the api documentation i cant see any mention of that being a requirement.
The AWS documentation? I don’t think it’s a requirement for AWS. It’s just how Serverless names things.
Thanks for your reply, yes I meant AWS, does serverless have any special tag to generate random numbers within names, or will have to create a js function get a random number going and pass it to serverless?
Also apologies if I missed it, but I couldn’t find what characters are allowing within normalised strings in serverless, is it a-z,A-Z,0-9,-,_?
Look at the source if you want a definitive answer but it looks like they’re using unix timestamps from the values I’m seeing.