rubyonjets/jets

Stack with id <name> does not exist (Aws::CloudFormation::Errors::ValidationError)

Closed this issue · 0 comments

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System OS 11.4
Jets 3.0.16
Ruby 2.7.3 via RVM

Expected Behaviour

First off, I love this framework and want to use it a lot to solve some issue we've been looking to solve in a legacy rails application...and... its not cooperating right now.

Initial jets deploy command for new application failing with AWS::CloudFormation::Errors::ValidationError stating the stack with the id of the project_name-dev doesn't exist.

Expect the first jets deploy command to create the stack being deployed.

Current Behavior

Have successfully deployed an initial application as an experiment on using this platform with no issues, I can still update it as well with no issues. I am now attempting to deploy a second application and am getting the error Stack with id carrier-dev does not exist (Aws::CloudFormation::Errors::ValidationError) on first deployment of any new applications. I have started multiple new projects, changed names, made sure there was only a single method to deploy and cannot get any of the new ones to deploy. The original still deploys and updates with no problems.

Step-by-step reproduction instructions

Steps

  1. Create new application with jets new <app_name> --mode api command
  2. Add index route in routes.rb
  3. Add Controller with index action in controllers directory
  4. By
  5. Bundle (I have bundled into vendor/gems)
  6. Attempt deploy using jets deploy or other similar command - see below.

Other things to note:

  1. I am using a second AWS profile set up per the instructions in the documentation to deploy the application. I deployed the first application using that profile, 7 days ago, and am attempting to deploy the other application with the same profile and credentials.
  2. There was an update to the the project's deploy.rb file five days ago. I did look at that PR briefly however am well versed in the project enough to accurately trouble shoot, though my gut says it may be in there somewhere. I am going to fork the repo and I can take a closer look.
  3. I did try to spin up a jets application on my personal computer, which has the same specs as my work computer where I first noted the issue, and I am getting the exact same error on a different machine and on a completely different AWS account as well, leading me to believe this may not be environmental in terms of my work machine, though user error is still a valid working theory as the common link in both failures is me.

Error Log

jets deploy
Deploying to Lambda carrier-dev environment...
Traceback (most recent call last):
	22: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/bin/jets:23:in `<main>'
	21: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/bin/jets:23:in `load'
	20: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/exe/jets:14:in `<top (required)>'
	19: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/cli.rb:5:in `start'
	18: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/cli.rb:28:in `start'
	17: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/base.rb:27:in `perform'
	16: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/base.rb:38:in `dispatch'
	15: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	14: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	13: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	12: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/main.rb:27:in `deploy'
	11: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/deploy.rb:21:in `run'
	10: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/deploy.rb:93:in `minimal_rollback_complete?'
	 9: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/jets-3.0.16/lib/jets/commands/deploy.rb:105:in `find_stack'
	 8: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-cloudformation-1.58.0/lib/aws-sdk-cloudformation/client.rb:3034:in `describe_stacks'
	 7: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/seahorse/client/request.rb:72:in `send_request'
	 6: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/seahorse/client/plugins/response_target.rb:24:in `call'
	 5: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'
	 4: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/seahorse/client/plugins/request_callback.rb:71:in `call'
	 3: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'
	 2: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'
	 1: from /Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'
/Users/robertcornell/.rvm/gems/ruby-2.7.3/gems/aws-sdk-core-3.121.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call': Stack with id carrier-dev does not exist (Aws::CloudFormation::Errors::ValidationError)

Code Sample

I have attempted deployment with the following flags as well:
jets deploy
AWS_REGION=us-west-2 bundle exec jets deploy
AWS_PROFILE=jets_user AWS_REGION=us-west-2 bundle exec jets deploy
AWS_PROFILE=jest_user AWS_REGION=us-west-2 JETS_ENV=staging bundle exec jets deploy

No version of this works successfully.

Solution Suggestion

I don't know if I'm burned out and missing something super obvious, but I've been stuck here for two days now trying to get my new applications to deploy and I am out of ideas, there isn't a lot of stack overflow on this just yet so I'm asking the source and hoping its either an easy fix or something I have just overlooked in my set up or something.

Am I missing something stupid obvious?

Edit: I am going to fork the project and take a closer look at the changes made 5 days ago to the deploy.rb file and the interplay there. It may be a red herring but worth a look. and I can learn about the project a bit more as well.

Edit: Ok so I forked the repo and I did some poking about. I added rescue block back into the find_stack method at line 106 in lib/jets/commands/deploy.rb

rescue Aws::CloudFormation::Errors::ValidationError => e
      # example: Stack with id demo-dev does not exist
      if e.message =~ /Stack with/ && e.message =~ /does not exist/
        nil
      else
        raise
      end

I bundled my fork/branch of the jets gem into my application and ran jets deploy, and I was able to indeed clear the originally reported error. The cloud formation stack is built, the S3 bucket is created and what appears to be the correct data is uploaded to it.

My initial deploy was the base Jets application, no additional routes or methods added. The deployment process proceeded but then seemed to stall out, after 10 mins I interrupted it, went back to the code and added in an index route and controller to my application and deployed an update.

That update did take some time to fully build but did eventually build successfully. And I was able to get to my working lambda via the url provided at the end of the update process.

https://0729j8b8p4.execute-api.us-west-2.amazonaws.com/dev/sports

I will submit a PR for this for your review, but from what I can tell, that rescue block being added back in solved my issue. Please check my work though, you know this project far better than I do.

Cheers.