I am using SEED to automate the deployment of my changes to the source code to dev and to prod. I have deployed to dev and then I click on the Promote button in SEED and I confirm since there are no changes in the environment and I get this error:
Serverless Warning --------------------------------------
A valid file to satisfy the declaration 'file(env.yml):dev,file(env.yml):default' could not be found.
Serverless: Invoke deploy
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:moveArtifactsToTemp
Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (1.52 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
...........................
Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: TreatmentLogs - dev-treatmentLogs already exists in stack arn:aws:cloudformation:us-east-1:968256005255:stack/spectrum-treatment-log-api-dev/df7e11d0-f373-11e8-8816-12c395c1242e.
Stack Trace --------------------------------------------
ServerlessError: An error occurred: TreatmentLogs - dev-treatmentLogs already exists in stack arn:aws:cloudformation:us-east-1:968256005255:stack/spectrum-treatment-log-api-dev/df7e11d0-f373-11e8-8816-12c395c1242e.
at provider.request.then (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:112:33)
From previous event:
at AwsDeploy.monitorStack (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:26:12)
at provider.request.then (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:95:30)
From previous event:
at AwsDeploy.update (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:95:8)
From previous event:
at AwsDeploy.BbPromise.bind.then (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:112:12)
From previous event:
at AwsDeploy.updateStack (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:106:8)
From previous event:
at AwsDeploy.BbPromise.bind.then (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/deploy/index.js:129:39)
From previous event:
at Object.aws:deploy:deploy:updateStack [as hook] (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/deploy/index.js:125:10)
at BbPromise.reduce (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:390:22)
at PluginManager.spawn (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:408:17)
at AwsDeploy.BbPromise.bind.then (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/deploy/index.js:95:48)
From previous event:
at Object.deploy:deploy [as hook] (/sls-1.29.2/node_modules/serverless/lib/plugins/aws/deploy/index.js:91:10)
at BbPromise.reduce (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:390:22)
at PluginManager.run (/sls-1.29.2/node_modules/serverless/lib/classes/PluginManager.js:421:17)
at variables.populateService.then.then (/sls-1.29.2/node_modules/serverless/lib/Serverless.js:157:33)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
at Serverless.run (/sls-1.29.2/node_modules/serverless/lib/Serverless.js:144:8)
at serverless.init.then (/sls-1.29.2/node_modules/serverless/bin/serverless:43:50)
at <anonymous>
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 8.10.0
Serverless Version: 1.29.2
2018/12/01 19:55:48 Error: exec: internal error
====================
đź—‘ Cleanup
====================
2018/12/01 19:55:48 Post deploy cleanup
I see that the stage is added correctly since SEED is deploying with the correct stage set explicitly through the command line.
Why is it trying to redeploy to dev when I am trying to promote to PROD only???
My confusion comes from this command when promoting to prod:
As you can see above SEED runs serverless deploy to prod with the correct stage, but when you look through the error log you see that SEED tries to deploy on DEV even though the command was to deploy on PROD:
tack Trace --------------------------------------------
ServerlessError: An error occurred: TreatmentLogs - dev-treatmentLogs already exists in stack arn:aws:cloudformation:us-east-1:968256005255:stack/spectrum-treatment-log-api-dev/df7e11d0-f373-11e8-8816-12c395c1242e.
Is there a way to configure SEED and the commands it runs on AutoDeploy?
Thanks and let me know if I should provide more info.
This build has timed out and has queued all subsequent builds. I am wondering if I should just delete the app and start over…
Any insight on the seed side of things would be helpful. I have created a services directory that is holding this first service in the mono repo I’ve decided with… Ive defined them as needed in seed but there is an issue with promoting to prod as described above.
Any ideas on this one? Really having a hard time on this one. Set it up as mono-repo following docs on SEED but not having much luck… What should my stage be set as under the provider attribute in my serverless.yml? It looks like this field is guiding the deployment of resources in prod… thanks. @jayair
I just tried again and it failed to deploy to PROD. I am confused because the stage I have set in my provider starts with dev. So far so good, it deploys to prod an every thing is fine. Here is the data defined in my serverless.yml file:
# NOTE: Update this with your service name
# New service names create new projects in AWS once deployed
service: spectrum-treatment-log-api
# Use the serverless-webpack plugin to transpile ES6
plugins:
- serverless-webpack
- serverless-offline
# serverless-webpack configuration
# Enable auto-packing of external modules
custom:
# Stages are based on what is passed in when running serverless
# commands. Or fllback to settings in provider section.
stage: ${opt:self, self:provider.stage}
# Set the table name to use it for testing locally
tableName: ${self:custom.stage}-treatmentLogs
# Set DynamoDB throughput for prod and all other non-prod stages.
tableThroughputs:
prod: 5
default: 1
tableThroughput: ${self:custom.tableThroughputs.${self:custom.stage}, self:custom.tableThroughputs.default}
# Load webpack config
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
# Load secret environment variables based on the current stage
# Fallback to default if it is not in PROD
environment: ${file(env.yml):${self:custom.stage}, file(env.yml):default}
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
# Environment variables made available through process.env
environment:
tableName: ${self:custom.tableName}
stripePrivateKey: ${self:custom.environment.stripePrivateKey}
The problem is that when I try to promote it to prod I get an internal service error. It looks like even though you are explicitly calling the stage prod from the command line, SEED still wants to promote it as dev and then I get the AWS error that says the dev deployment already exists.
How can I get it to deploy to prod??? It is still trying to deploy to dev as you can see below. Here is the link and the error from the SEED build log this AM: