Shopify / shipit-engine

Deployment coordination
https://shopify.engineering/introducing-shipit
MIT License
1.42k stars 146 forks source link

Update octokit_iterator.rb #1308

Closed kartiki975 closed 1 year ago

kartiki975 commented 1 year ago

I came across this bug here. There's only been a few instances so far but fixed it since it was fairly quickly; it resulted from data being called on a null response object.

I didn't find any unit tests for OctokitIterator class, so, I didn't add any test for this bug fix. If you disagree, do lmk!

casperisfine commented 1 year ago

For the benefit of external users:

bundler/gems/shipit-engine-0419ae9aebd9/lib/shipit/octokit_iterator.rb:19:in `block in each': undefined method `data' for nil:NilClass (NoMethodError)
    from bundler/gems/shipit-engine-0419ae9aebd9/lib/shipit/octokit_iterator.rb:18:in `loop'
    from bundler/gems/shipit-engine-0419ae9aebd9/lib/shipit/octokit_iterator.rb:18:in `each'
    from bundler/gems/shipit-engine-0419ae9aebd9/lib/shipit/first_parent_commits_iterator.rb:6:in `each'
    from bundler/gems/shipit-engine-0419ae9aebd9jobs/shipit/github_sync_job.rb:40:in `each_with_index'
    from bundler/gems/shipit-engine-0419ae9aebd9jobs/shipit/github_sync_job.rb:40:in `fetch_missing_commits'
    from bundler/gems/shipit-engine-0419ae9aebd9jobs/shipit/github_sync_job.rb:19:in `block in perform'
    from bundler/gems/shipit-engine-0419ae9aebd9jobs/shipit/github_sync_job.rb:54:in `handle_github_errors'
    from bundler/gems/shipit-engine-0419ae9aebd9jobs/shipit/github_sync_job.rb:18:in `perform'
    from gems/activejob-7.0.4.3/lib/active_job/execution.rb:59:in `block in _perform_job'