需要帮助诊断Heroku中的500错误 [英] Need help diagnosing a 500 error in Heroku

查看:124
本文介绍了需要帮助诊断Heroku中的500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一个使用天气API在一个页面上显示当地天气的类建了一个webapp。我已经将应用上传到Heroku,但是当我尝试查看该页面时,出现500错误。我已经看过日志,但是我无法解读究竟发生了什么问题。有人可以看看日志并指出发生了什么问题吗?

以下是日志的链接: https://gist.github.com/allredbm/70daea5a4c372c644cac

解决方案

错误如下:

  app / controllers / home_controller.rb:18:在'index' 
NoMethodError(未定义方法`[]'为nil:NilClass)

在线 18 你的 home_controller index 动作)一个带有 [] 的变量。该变量未定义。



您需要确保变量在尝试引用前已定义。


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

解决方案

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.

这篇关于需要帮助诊断Heroku中的500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆