dsmith (4) [Avatar] Offline
#1
Apologies if this is answered later in the course...

After finishing the CI/CD section, it appears that to run the acceptance tests we need to know the endpoint that will be associated with the deployment, which gets hard-coded into the script in package.json. This means that the stack was deployed at least once before hand, and that the pipeline is coupled to that deployment.

In practice is this something that is done, or would a next logical step be to add some aws cli commands to extract the stack resources associated with the sls deploy as part of the build script to derive the environment at build time in the pipeline? Or are there other approaches we should consider.

Thanks!
Yan Cui (62) [Avatar] Offline
#2
Unfortunately I don't think we'll have the time to address this properly in the course, but I can mention something in the wrap-up video.

In practice, this problem is solved by having custom domain names - well known URLs that follow some convention, e.g. my-api.dev.my-domain.com. See this post on how to set it up using the Serverless framework and a plugin.

In which case, you can automate the creation of the domain with your build script, but, since it takes 40mins to provision the new custom domain name, the first time it runs for a new environment the acceptance tests would still fail, unless you manually create the domain ahead of time.