serverless-deploy failed - ValidationError: Stack with id does not exists
Asked by Vitor Oliveira:

I'm deploying a serverless application using pipe atlassian/serverless-deploy:1.0.0 but I've gotten this error:

     Serverless Error ----------------------------------------   ServerlessError: ValidationError: Stack with id bankslip-register-hmg does not exist      at Request.extractError (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/protocol/query.js:50:29)      at Request.callListeners (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:106:20)      at Request.emit (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:78:10)      at Request.emit (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:688:14)      at Request.transition (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)      at AcceptorStateMachine.runTo (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)      at /usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10      at Request.<anonymous> (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)      at Request.<anonymous> (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:690:12)      at Request.callListeners (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:116:18)      at Request.emit (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:78:10)      at Request.emit (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:688:14)      at Request.transition (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)      at AcceptorStateMachine.runTo (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)      at /usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10      at Request.<anonymous> (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)      at Request.<anonymous> (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:690:12)      at Request.callListeners (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:116:18)      at callNextListener (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:96:12)      at IncomingMessage.onEnd (/usr/lib/node_modules/serverless/node_modules/aws-sdk/lib/event_listeners.js:313:13)      at IncomingMessage.emit (events.js:326:22)      at IncomingMessage.EventEmitter.emit (domain.js:483:12)      at endReadableNT (_stream_readable.js:1241:12)      at processTicksAndRejections (internal/process/task_queues.js:84:21)  ----------------------------------------------------------------------------------------------------      at /usr/lib/node_modules/serverless/lib/aws/request.js:202:11      at processTicksAndRejections (internal/process/task_queues.js:97:5)   Get Support --------------------------------------------     Docs:          http://docs.serverless.com     Bugs:          http://github.com/serverless/serverless/issues     Issues:        http://forum.serverless.com   Your Environment Information ---------------------------     Operating System:          linux     Node Version:              12.22.0     Framework Version:         2.33.1     Plugin Version:            4.5.3     SDK Version:               4.2.2     Components Version:        3.8.1

This error occurs only on first deployment of stack. If I run this on my local machine it works as expected

I've seen all possibilities showed here: <https://seed.run/docs/serverless-errors/stack-with-id-does-not-exist.html> but no one matches with my environment


Answers:
author: Halyna Berezovska
body: [@Vitor Oliveira](/t5/user/viewprofilepage/user-id/4319757) let's investigate more about that.

Have you tried to run the pipeline after failure again. Does it still shows error on the second execution?

The error show that stack does not exist, that means it was not created. Unfortunately, I see here, it is not shown in the log why it was not created, but you could try to find stacks in Cloudformation Console that status after deployment (failed first deployment, I mean) is equal to CREATE_FAILED. AWS Cloudformation in activity tab explains initial reasons of failure.

That will explain you the initial root cause.

We also do not know, if there is any difference between running on pipeline and running locally, because you run it in pipeline only once and then try locally. So the reason, perhaps , is not that is first deployment, but pipeline deployment with the setup that is different from your local setup.

To help us find the root cause, please

- run the pipeline with your template,

- if it fails, try to find failed Cloudformation stack in aws console and look for errors there in Events tab,

- try to run it in pipeline again, not locally.

Feedback us with the result you'll have, then we will have more information to be able to help you.

It is often situation that AWS does show more information in console, rather in api, we use (whatever it is, serverless api or aws cli or boto api).

Regards, Galyna


Tags: bitbucket-pipelines

cloud