civo / cli-rubygem

Command line interface for interacting with Civo's cloud API
https://www.civo.com
MIT License
15 stars 4 forks source link

Exception encountered whilst running `instance create --wait ` #34

Closed alexellis closed 4 years ago

alexellis commented 5 years ago

I encountered an exception whilst running instance create --wait

This may be confusing to new users.

I would suggest adjusting the API rate limit for Civo's service, or backing-off on the retry for the polling.

cc @andyjeffries @kaihoffman

[alex@nuc ~]$  civo instance create \
>   --name ${HOST} \
> --ssh-key ${SSH_KEY_ID} \
>   --template=${TEMPLATE} \
>   --wait
Building new instance k3sup-1: \
/
\
\
Traceback (most recent call last):
    27: from /home/alex/.gem/ruby/2.6.0/bin/civo:23:in `<main>'
    26: from /home/alex/.gem/ruby/2.6.0/bin/civo:23:in `load'
    25: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/exe/civo:6:in `<top (required)>'
    24: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
    23: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    22: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    21: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    20: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
    19: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
    18: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    17: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    16: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    15: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/instance.rb:145:in `create'
    14: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/spinner.rb:9:in `spin'
    13: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/spinner.rb:9:in `new'
    12: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/spinner.rb:18:in `initialize'
    11: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/spinner.rb:45:in `spin'
    10: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/instance.rb:146:in `block in create'
     9: from /home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/mapping.rb:28:in `block in _map_call'
     8: from /home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/mapping.rb:46:in `_call'
     7: from /home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/request.rb:181:in `call'
     6: from /home/alex/.gem/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:in `instrument'
     5: from /home/alex/.gem/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
     4: from /home/alex/.gem/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:in `block in instrument'
     3: from /home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/request.rb:229:in `block in call'
     2: from /home/alex/.gem/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete'
     1: from /home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/request.rb:256:in `block (2 levels) in call'
/home/alex/.gem/ruby/2.6.0/gems/flexirest-1.7.9/lib/flexirest/request.rb:584:in `handle_response': The GET to '/v2/instances' returned a 429 status, which raised a Flexirest::HTTPClientException with a body of: {"error":"Throttle limit reached. Retry later."} (Flexirest::HTTPClientException)
    13: from /home/alex/.gem/ruby/2.6.0/bin/civo:23:in `<main>'
    12: from /home/alex/.gem/ruby/2.6.0/bin/civo:23:in `load'
    11: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/exe/civo:6:in `<top (required)>'
    10: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
     9: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
     8: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
     7: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
     6: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
     5: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
     4: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
     3: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
     2: from /home/alex/.gem/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
     1: from /home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/instance.rb:115:in `create'
/home/alex/.gem/ruby/2.6.0/gems/civo_cli-0.3.10/lib/instance.rb:159:in `rescue in create': undefined method `colorize' for nil:NilClass (NoMethodError)
kaihoffman commented 5 years ago

Looking to up rate limits on the API (@andyjeffries )

andyjeffries commented 5 years ago

I've upped the rate limit now, however, it's still weird that this isn't trapped by the rescue Flexirest::HTTPException already?

kaihoffman commented 5 years ago

I think it might be because it's not getting an HTTPException but rather a Nil object. Would the rate limit increase prevent this from happening?

kaihoffman commented 5 years ago

@alexellis Given we're now on the CLI version 0.4.4 and the above was encountered on 0.3.10 as well as the rate limits being higher, are you able to still replicate this issue? If not, I would consider it fixed and will close the issue.

kaihoffman commented 4 years ago

Closing as should be fixed.