Heroku 应用程序丢弃初始请求
每当我第一次在 Heroku 上使用我的应用程序(大约 10 分钟)时,它就会失败。出了点问题错误。但刷新一下,总能解决问题吗?有什么想法可能导致这种情况吗?感谢您的帮助!
Whenever I hit my application on Heroku for the first time (over a period of about 10 minutes), it fails. Something went wrong error. But a refresh, always fixes the problem? Any ideas what might be causing this? Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用 1 个测功机(免费方式)运行,则您的测功机将在一段时间不活动后关闭,并根据下一个请求重新启动。因此,当您将其放置 10 分钟时,它会关闭并尝试根据第一个请求重新启动。该过程通常非常快,您会看到 3-5 秒的启动延迟,但不足以让您超时。
您在启动过程中是否遇到过需要很长时间的事情?
另外,如果值得每月支付一点费用,您可以将其提高到 2 个 dyno,并且它们不会在付费应用程序上降低速度。
If you are running with 1 dyno (the free way) then your dyno will shut down after some period of inactivity and get started back up upon the next request. So, when you leave it alone for 10 minutes it gets shutdown and tries to spin back up on that first request. That process is usually pretty fast and you will see a 3-5 sec startup lag but not enough to time you out.
Do you have anything going on during startup that would take a long time?
Also, if it is worth paying a little bit per month you can bump it up to 2 dynos and they will not spin it down on paid apps.
当我将指南针框架添加到我的应用程序时,我遇到了同样的问题。在我的错误日志中,我收到此错误:
Errno::EACCES (权限被拒绝 - /app/public/stylesheets/screen.css)
按照这些说明解决了问题
http://devcenter.heroku.com/articles/using-compass
I was having the same issue when I added the compass framework to my application. In my error logs I was getting this error:
Errno::EACCES (Permission denied - /app/public/stylesheets/screen.css)
Following these instructions solved the problem
http://devcenter.heroku.com/articles/using-compass
以@Ben 100%正确的答案为基础,有一个问题:它没有看到你遇到超时错误。 “出现错误”错误表示 500 错误,因此您的应用程序正在加载,但某些内容引发了异常。如果它仅发生在第一个请求上,则仅在第一个请求上加载/执行的某些内容导致了问题。
如果是这种情况,那么要查看错误,请检查日志:
或者注册错误报告附加组件,例如 Exceptional(它是免费的!):
然后您可以从应用程序的 Heroku 仪表板访问 Exceptional -到达那里后,使用右上角的“附加组件”菜单。
To build on @Ben's answer, which is 100% correct, there's one issue: it doesn't seen you're getting a timeout error. The "Something Went Wrong" error indicates a 500 error, so your app is being loaded, but something is throwing an exception. If it only happens on the first request, then there is something that is being loaded/executed only on the first request which is causing the problem.
If this is the case, then to see the error, check your logs:
Or sign-up for an error-reporting add-on, like Exceptional (it's free!):
You can then access Exceptional from your Heroku dashboard for your app - once there, use the "Add-ons" menu in the upper-right.
在过去的几年里,我的所有应用程序都发生过这种情况。直到现在我才真正弄清楚这一点。
在第一个请求的日志中,我得到以下信息: Errno::EACCES (权限被拒绝 - /app/public/stylesheets/screen.css)
第二个连续请求工作正常,没有此错误。我想不出我的 screen.css 文件有什么问题。
This has happened to me on all my apps for the past couple years. I never was annoying enough to really figure it out until now.
In my logs on the first request, I get this: Errno::EACCES (Permission denied - /app/public/stylesheets/screen.css)
The second, and sequential, requests work fine without this error. I can't think of anything wrong with my screen.css file.