Closed nectarcode closed 3 years ago
If i try deploying to api.mydomain.com with the production stage, I get the following error.
The domain api.mydomain.com is already in use by another API
So as of right now it seems I can only deploy dev stage, and only to a single subdomain.
You define it in your .env and .env.prod file, then use a reference like this in your serverless.yml file:
inputs:
src: ./
region: us-east-1
domain: ${env:GRAPHQL_DOMAIN}
.env.prod
GRAPHQL_DOMAIN=wallet1.XXX.com
.env
GRAPHQL_DOMAIN=devwallet1.XXX.com
Thanks for your response! I appreciate your input, and while using dynamic variables is a great way to achieve the goal of deploying to two different stages/subdomains with a single yml file, my problem is a little bit simpler. I'm not able to deploy to any stage other than dev
...if I try to hardcode stage prod
or if I try to deploy to anything other than api.mydomain.com (ie: dev.api.mydomain.com) I get the error messages above, such as:
The domain api.mydomain.com is already in use by another API
and
Changing the domain from api.mydomain.com to dev.mydomain.com will remove your infrastructure. Please remove it manually, change the domain, then re-deploy.
Maybe I need to use a different name:
variable?
OK I see what my issue was...because i initially deployed dev
stage to api.mydomain.com, i can't deploy prod
stage to api.mydomain.com
I discovered this by deploying to staging
stage with no issue.
So in order to deploy prod
stage to api.mydomain.com, i need to first remove it, then proceed to deploy dev
stage to dev.api.mydomain.com
Thanks again for the .env, .env.prod tips!
Description
I'd like to deploy to dev.api.mydomain.com if the stage is dev, and api.mydomain.com if the stage is prod.
I tried changing the domain manually when I change the stage, but I get the error:
Changing the domain from api.mydomain.com to dev.mydomain.com will remove your infrastructure. Please remove it manually, change the domain, then re-deploy.
I don't want to remove my infrastructure at api.mydomain.com, I'd like to deploy the same code to two different subdomains. Is this achievable or am I missing something?
Additional Data
serverless.yml