thegreenrobot / pagerduty_dashing

A Dashing dashboard for PagerDuty Services & Schedules
MIT License
44 stars 23 forks source link

Undefined method '[]' for nil:NilClass #3

Closed dshack closed 10 years ago

dshack commented 10 years ago

Any idea why I might be seeing this?

================================================================================
127.0.0.1 - - [06/May/2014 15:13:38] "GET /events HTTP/1.1" 200 - 37.8367
127.0.0.1 - - [06/May/2014 15:13:38] "GET /incidents HTTP/1.1" 200 3051 0.0102
================================================================================
scheduler caught exception:
undefined method `[]' for nil:NilClass
/Users/dshack/pagerduty_dashing/jobs/pagerduty_oncall.rb:30:in `block (2 levels) in <top (required)>'
/Users/dshack/pagerduty_dashing/jobs/pagerduty_oncall.rb:17:in `each'
/Users/dshack/pagerduty_dashing/jobs/pagerduty_oncall.rb:17:in `block in <top (required)>'
/Users/dshack/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `call'
/Users/dshack/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `trigger_block'
/Users/dshack/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in `block in trigger'
/Users/dshack/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `call'
/Users/dshack/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_job'
================================================================================
chjohnst commented 10 years ago

I see similar behavior, I actually don't think this is working. I popped a print in here and it never goes through my list of entries in the json.

16 SCHEDULER.every '1s' do 17 schedules.each do |key, value| 18 print key

chjohnst commented 10 years ago

I have a code fix for this, I can push this up this weekend

thegreenrobot commented 10 years ago

Sorry to hear you're having these issues.

So as an experiment I cloned the repo fresh and did the following:

  1. In the root of the repo, create the lib dir --- $ mkdir lib
  2. Create the secrets.json file with your specific URL, api_key and schedules IDs --- $ vim lib/secrets.json
  3. Start dashing -- rackup -p 3030 -s webrick
  4. Open up a browser and navigate to http://localhost:3030/oncall and wait for it to poll

I didn't make any changes in the oncall.erb or the pagerduty_oncall.rb, it just worked.

dshack commented 10 years ago

@chjohnst did you also config your oncall.erb?

I can't actually remember how I fixed this, but I think it was similar to @thegreenrobot : I just cloned a fresh repo.

thegreenrobot commented 10 years ago

I didn't even have to update oncall.erb.