There are some variables that need to be set up before removing too. For example, I'm using serverless-domain-manager. When deploying for the stage 'dev', I use api.example.xyz and when deploying for stage 'prod' it should be 'api.example.com'. It can be achieved without a problem.
But the problem is when using sls remove -s prod. When running that command this plugin does not fire, resulting the domain name to be api.example.xyz. This is problematic when detaching the api-mappings because dev and prod are in two separate AWS accounts. Even being in the same account will cause errors.
So it's best to fire the plugin in before:remove:remove lifecycle event.
There are some variables that need to be set up before removing too. For example, I'm using
serverless-domain-manager
. When deploying for the stage'dev'
, I useapi.example.xyz
and when deploying for stage'prod'
it should be'api.example.com'
. It can be achieved without a problem.But the problem is when using
sls remove -s prod
. When running that command this plugin does not fire, resulting the domain name to beapi.example.xyz.
This is problematic when detaching the api-mappings because dev and prod are in two separate AWS accounts. Even being in the same account will cause errors.So it's best to fire the plugin in before:remove:remove lifecycle event.