B. Allred
B. Allred

Reputation: 439

Need help diagnosing a 500 error in Heroku

I built a webapp for a class that uses a weather API to display the local weather on a single page. I've uploaded the app to Heroku, but when I try to view the page, I get a 500 error. I've looked at the logs, but I can't decipher what is going wrong exactly. Can someone please take a look at the logs and point out what's going wrong?

Here is a link to the logs: https://gist.github.com/allredbm/70daea5a4c372c644cac

Upvotes: 0

Views: 61

Answers (2)

Richard Peck
Richard Peck

Reputation: 76774

The error is as follows:

app/controllers/home_controller.rb:18:in `index'
NoMethodError (undefined method `[]' for nil:NilClass)

On line 18 of your home_controller (index action), you're referencing a variable with a []. The variable isn't defined.

You need to make sure the variable is defined before trying to reference it.

Upvotes: 1

miligraf
miligraf

Reputation: 1072

You can view the whole backtrace by doing either:

  • Set config.consider_all_requests_local = true in config/environments/production.rb - this is the quickest
  • Add New Relic (free), configure it, reproduce the 500, wait 1 minute and go into the errors tab in New Relic - this is the preferred as you don't expose the error to the public

Upvotes: 0

Related Questions