Heroku - 应用程序错误

问题描述:

我用Ruby on Rails创建了一个简单的应用程序,我试图在Heroku上提交它。我已经按照这个Getting Started on Heroku guide, 我完成它,并尝试打开我的页面,但我仍然看到了一个错误: 应用程序错误:Heroku - 应用程序错误

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

有人知道如何处理呢?


我不知道是什么发生,但我已经做了这一步,遗憾的是我还有一个问题,我跑了几个命令:

# git add .
# git commit -m "my commit"
On branch master nothing to commit (working directory clean)
# git push heroku master Everything up-to-date
# heroku open Opening http ://eerie-meadow-9207.heroku.com/
# heroku restart Restarting processes... done
# heroku open Opening http ://eerie-meadow-9207.heroku.com/

,我看到一则消息:

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

heroku logs[为了清楚起见移除时间戳]

app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:38 -0700 
app[web.1]: Processing by StoreController#index as HTML 
app[web.1]: Completed 500 Internal Server Error in 3ms 
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=728 
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:38 -0700] "GET/HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com 
app[web.1]: 
heroku[web.1]: State changed from up to bouncing 
heroku[web.1]: State changed from bouncing to created 
heroku[web.1]: State changed from created to starting 
heroku[web.1]: Starting process with command `thin -p 40376 -e production -R /home/heroku_rack/heroku.ru start` 
heroku[web.1]: Process exited 
app[web.1]: >> Maximum connections set to 1024 
app[web.1]: >> Listening on 0.0.0.0:40376, CTRL+C to stop 
app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious) 
heroku[web.1]: State changed from starting to up 
app[web.1]: 
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:59-0700 
app[web.1]: 
app[web.1]: Processing by StoreController#index as HTML 
app[web.1]: Completed 500 Internal Server Error in 4ms 
app[web.1]: 
app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: relation "products" does not exist 
app[web.1]: :    SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull 
app[web.1]:    FROM pg_attribute a LEFT JOIN pg_attrdef d 
app[web.1]:   ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
app[web.1]:    WHERE a.attrelid = '"products"'::regclass 
app[web.1]:   AND a.attnum > 0 AND NOT a.attisdropped 
app[web.1]:    ORDER BY a.attnum 
app[web.1]:): 
app[web.1]: app/controllers/store_controller.rb:3:in `index' 
app[web.1]: 
app[web.1]: 
app[web.1]: cache: [GET /] miss 
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=81ms status=500 bytes=728 
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:59 -0700] "GET/HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com 
app[web.1]: 
app[web.1]: 
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:54:00-0700 
app[web.1]: Processing by StoreController#index as HTML 

我无法理解它,因为在我的上网本上,它在localhost上工作,有什么想法?

+2

一个解决办法:'Heroku的logs'控制台知道发生了什么 – apneadiving

+1

你用什么堆栈? 'heroku堆栈'和哪个rails版本? –

+0

这可能是许多事情。你看过日志还是检查了你的代码是你打算在教程中输入的内容? –

大部分时间,heroku问题是由于缺乏访问文件系统的权限。为了让你的应用程序在heroku上工作,你必须确保它不会尝试写入任何东西到磁盘(但在临时文件夹中)。

典型的例子是js/css编译过程,例如,与指南针,你会发现他们的知识数据库上的解决方案:http://devcenter.heroku.com/articles/using-compass

你应该看看heroku日志进一步看看应用程序启动时或第一次请求期间是否有任何“权限被拒绝”的问题。

+0

好 - 已解决,但现在,我有另一个问题 - 我编辑了我的帖子 – ruhungry

+0

谢谢。配置指南针与Heroku一起工作对我很有用。 – Ryan

尝试用heroku restart重新启动您的应用。假设你的应用程序在本地运行良好,这应该可以做到。它解决了我的问题,因为我只重构架构和数据库:重置似乎没有办法。

+0

我在本地运行我的应用程序,它的工作原理。 Heroku重新启动:重新启动进程...完成,接着heroku打开,我看到这个相同的错误...我读了这可能是一个问题,如果你多次使用命令HEROKU CREATE。我创建了大约6-7个项目,但我从HEROKU网站中删除了所有这个项目。任何其他想法? – ruhungry

+0

看看我的答案中的视频。首次将3.1应用程序上传到heroku的资源不足,但该视频指导您阅读并解决错误。 – Dru

+0

这对我有用。我已经离开了应用程序睡了一段时间,因为没有什么改变,我很困惑,为什么它没有工作。 – Rohmer

http://www.youtube.com/watch?v=p_3dIPgXgkg

如果您已经申请建造,去点上的视频时,他开始推样品应用的Heroku。不幸的是,当第一次上传3.1应用程序时,heroku很难解决错误。按照视频中的问题排查步骤操作即可。

+0

我会尝试'heroku db:reset'然后'heroku db:migrate'如果这些命令集不起作用,请尝试'heroku destroy'并使用youtube教程重新部署教程故障排除方法 – Dru

尝试使用命令

heroku run rake db:migrate

+0

这将实现什么功能? – jhoyla

+0

这给我返回的语法错误,我错过了。感谢这个提示。我从来不会从heroku日志命令中猜出来。 – ksu

+0

我有一个类似的错误,example.com/users在railstutorial.org的这一步中给出了相同的html输出:https://www.railstutorial.org/book/toy_app#sec-demo_users_resource并使用'heroku run rake db:migrate'解决了我的问题。谢谢! – Ekin