Could someone help further explain how to set up stages for API endpoints?
Right now, I have 3 stages setup: DEV, STAGING, and PROD. Each work with my frontend, but only with the latest deployment. For example…
- I deploy the API to DEV, I can’t access the STAGING or PROD APIs anymore from the client.
- I deploy the API to STAGING, I can’t access the DEV or PROD APIs anymore from the client.
- I deploy the API to PROD, I can’t access the DEV or STAGING APIs anymore from the client.
I looked into it and in the API Gateway, the stages are being created without a problem. However, the lambda functions backing the API are replaced with each stage. So, if I have a DEV-{function} lambda function, when I deploy using --stage STAGING
, it is replaced with STAGING-{function}. I would expect DEV-{function} to not get replaced and STAGING-{function} to just be added (or updated).
I think this might be me misunderstanding the concept, as it’s explained that it is better to have separate APIs, one for each stage. However, I don’t know how to set this up in the serverless.yml.
Can anyone help?
Thanks in advance!