Prewarming exception

Hi Tung, I’m getting a prewarm exception

Prewarming application.
/home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/preheat.rb:94:in `all_functions': undefined local variable or method `cfn' for #<Jets::Preheat:0x00007fa778a1f2f8 @options={:mute=>true, :mute_output=>true, :invocation_type=>"Event", :lambda_proxy=>false}> (NameError)

      parent_stack = cfn.describe_stack_resources(stack_name: Jets::Names.parent_stack_name)
                     ^^^
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/memoist-0.16.2/lib/memoist.rb:169:in `all_functions'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/preheat.rb:32:in `warm_all'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/preheat.rb:15:in `warm_all'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/internal/app/jobs/jets/preheat_job.rb:51:in `warm'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/job/base.rb:31:in `perform_now'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/internal/app/jobs/jets/preheat_job.rb:59:in `prewarm!'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/cfn/ship.rb:108:in `prewarm'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/cfn/ship.rb:46:in `run'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/commands/deploy.rb:75:in `ship'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/commands/deploy.rb:36:in `run'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/commands/main.rb:27:in `deploy'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/commands/base.rb:38:in `dispatch'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/commands/base.rb:27:in `perform'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/cli.rb:28:in `start'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/lib/jets/cli.rb:5:in `start'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/gems/jets-4.0.1/exe/jets:14:in `<top (required)>'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/bin/jets:25:in `load'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/bin/jets:25:in `<main>'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/bin/ruby_executable_hooks:22:in `eval'
        from /home/ec2-user/.rvm/gems/ruby-3.2.1/bin/ruby_executable_hooks:22:in `<main>'

Environment:
Jets 4.0.1
Ruby is 3.2.1 (rvm, x86_64)

I’m guessing it’s the cfn function is not properly configured (via memoist?), maybe from the newer Ruby version.

I don’t see any errors in CloudTrail, so it doesn’t look like IAM permissions.

Thanks!
Jacob

I’m trying to do some investigation, and this little jets console session works fine, so I don’t think it’s a Ruby 3.2 issue.

class Foo
  include Jets::AwsServices
  def go
    return cfn
  end
end
fun = new Foo
fun.go.describe_stack_resources(stack_name: Jets::Names.parent_stack_name)

Ahh… just saw the fix in 4.0.2 (https://github.com/boltops-tools/jets/blob/master/CHANGELOG.md), much thanks! I can confirm it’s working.

1 Like