rollbar-gem: Capistrano deploy fails if No/incorrect Access token is provided in version 2.19.x
I upgraded to 2.19.1, and my cap production deploy started failing. This was working on 2.18.2.
Investigating this, I found that I was not specifying a rollbar_token properly in the deploy.rb file.
Yes, I agree that finding this out was good for my project, though a warning may have been sufficient.
BUT, I feel that this is a breaking change, and should not have been introduced without more warning in the changelog (and perhaps a major version bump). I suspect that some people may want to be able to perform deploys to some environments without informing rollbar…so perhaps this wasn’t introduced on purpose.
Summary:
- If you don’t have a
rollbar_tokenspecified properly, capistrano deploy will fail - If you do have a
rollbar_tokenspecified, but it is invalid, capistrano deploy will fail.
Error messages:
Without token:
00:10 rollbar:deploy_started
Notifying Rollbar of deployment start
#<URI::HTTPS https://api.rollbar.com/api/1/deploy/>: {"access_token":null,"environment":"production","revision":"90a4de294fcc1953d0a6f5371abc6ef30c705485","rollbar_username":null,"local_username":null,"comment":null,"status":"started","proxy":"ENV","dry_run":false}
400; Bad Request; { "err": 1, "message": "access token required"}
#<Thread:0x000055658df84768@/home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as <redacted>: undefined method `[]' for nil:NilClass (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as <redacted>: undefined method `[]' for nil:NilClass
Caused by:
NoMethodError: undefined method `[]' for nil:NilClass
Tasks: TOP => rollbar:deploy_started
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as <redacted>: undefined method `[]' for nil:NilClass
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
With invalid token:
00:10 rollbar:deploy_started
Notifying Rollbar of deployment start
#<URI::HTTPS https://api.rollbar.com/api/1/deploy/>: {"access_token":"067e6535b60f456ba3efaa33df02fac6","environment":"production","revision":"a3edc3c0c7b431505f30618893280988e0e220be","rollbar_username":null,"local_username":null,"comment":null,"status":"started","proxy":"ENV","dry_run":false}
403; Forbidden; { "err": 1, "message": "access token not found: 067e6535b60f456ba3efaa33df02fac6"}
#<Thread:0x000055ae64cb3690@/home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/circleci/tmp/vendor/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as <redacted>: undefined method `[]' for nil:NilClass (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as <redacted>: undefined method `[]' for nil:NilClass
Caused by:
NoMethodError: undefined method `[]' for nil:NilClass
Tasks: TOP => rollbar:deploy_started
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as <redacted>: undefined method `[]' for nil:NilClass
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (16 by maintainers)
Commits related to this issue
- Merge pull request #837 from rollbar/capistrano-fix Issue #832: Capistrano hotfix — committed to rollbar/rollbar-gem by ArturMoczulski 5 years ago
@rdunlop , @innocode-devops , thank you! The new stack traces are very helpful.