基本上,在我git推送到Heroku之后,我的网站抛出一个名为
的错误应用程序错误:应用程序和页面中发生错误
无法送达。如果您是应用程序所有者,
查看日志以获取详细信息。
但是当我刷新页面时,我的网站成功加载......为什么?
为了您的信息,我使用Rails在Heroku上运行Hobbyist Dyno
git push staging master
heroku logs -t --remote staging
2017-01-10T19:07:34.332770+00:00 app[api]: Release v54 created by user xxx@gmail.com
2017-01-10T19:07:35.190813+00:00 heroku[web.1]: Restarting
2017-01-10T19:07:35.191331+00:00 heroku[web.1]: State changed from up to starting
2017-01-10T19:07:35.233553+00:00 heroku[worker.1]: Restarting
2017-01-10T19:07:35.234020+00:00 heroku[worker.1]: State changed from up to starting
2017-01-10T19:07:35.995721+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-01-10T19:07:36.104550+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
> 2017-01-10T19:07:36.082662+00:00 app[web.1]: [4] - Gracefully shutting down workers...
> 2017-01-10T19:07:36.121359+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Shutting down
> 2017-01-10T19:07:36.121553+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Terminating quiet workers
> 2017-01-10T19:07:36.122499+00:00 app[worker.1]: 4 TID-ow39cbrbg INFO: Scheduler exiting...
> 2017-01-10T19:07:36.623708+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Pausing to allow workers to finish...
> 2017-01-10T19:07:37.504392+00:00 app[web.1]: [4] === puma shutdown: 2017-01-10 19:07:37 +0000 ===
> 2017-01-10T19:07:37.504408+00:00 app[web.1]: [4] - Goodbye!
> 2017-01-10T19:07:37.800069+00:00 heroku[web.1]: Process exited with status 0
> 2017-01-10T19:07:38.127333+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Bye!
> 2017-01-10T19:07:38.345364+00:00 heroku[worker.1]: Process exited with status 0
> 2017-01-10T19:07:42.226982+00:00 heroku[web.1]: Starting process with command
答案 0 :(得分:1)
我发现问题来自于我的production.rb配置。我使用New Relic APM帮助我缩小范围,导致超时。发现它不是我的中间件或后端。这基本上是我的资产管道问题。
config.assets.debug = true #I was setting it to true..
config.assets.debug = false #<- fixes the issue... Plus, I was putting unnecessary js codes in my application.html.erb
我得到了很多关于Sidekiq的知识,并认为它导致问题大声笑,并且肯定New Relic APM在跟踪代码的哪一部分导致超时问题时非常棒。另外,尽量不要在一个页面中放入太多的js代码......
答案 1 :(得分:0)
按照以下步骤解决问题: