Heroku Django Gunicorn错误H18(请求中断)错误

发布于 2025-02-03 04:46:58 字数 350 浏览 5 评论 0原文

我正在使用DjangoGunicorn on Heroku。我通过发布到后端发送某些文件(不需要存储)的 https 请求,本地一切正常。 但是在Heroku我发送小文件(< 13kbytes)时,它有效,但是对于较大的文件,我会得到

错误H18(请求中断)。

如果该错误是来自Heroku本身,我无法理解该错误的原因,如果它来自请求的正文或gunicorn

找出任何想法的可能原因的最佳方法是什么?

I'm using Django with Gunicorn on heroku. And I make https requests via post to my backend sending some files (which don't need to be stored), locally everything works fine.
But on heroku when I send small files (<13kbytes) it works, but for larger files I get

Error H18 (Request Interrupted).

I couldn't understand the reason for the error, if it's from heroku itself, if it's from the body of the request to be large or from gunicorn.

What would be the best way to find out the possible cause of this, any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红焚 2025-02-10 04:46:58

这是 clue

H18表示连接插座,某些数据作为部分发送
该应用程序的响应,但随后插座被破坏而没有
完成响应

您可能已经体验了限制如果您是免费用户。但是,最好确定问题而不是猜测。您可以做的是安装 heroku cli 。然后,设置帐户后,在您的后端发送另一个大文件。这将再次返回H18错误。然后,您可以在终端中追踪问题:

$ heroku login
$ heroku logs --tail --app <your-heroku-app-name>

Here's a clue:

An H18 signifies that the socket connected, some data was sent as part
of a response by the app, but then the socket was destroyed without
completing the response

You might have experienced one of the limitations on heroku if you're a free user. However, it's best to pinpoint the issue instead of speculating. What you can do is install the Heroku CLI. Then, after you setup your account, send another large file on your backend. This will return the H18 error again. You can then trace the issue in your terminal with this:

$ heroku login
$ heroku logs --tail --app <your-heroku-app-name>
吾性傲以野 2025-02-10 04:46:58

对于将来有同样问题的人来说,我的问题出现了,我不等待所有文件都被上传,本地工作是由于即时上传的文件,但在服务器中没有立即上传。因此,要解决我的问题,我需要使用等待和纸张等待文件,然后再致电后端。

For people in the future with the same problem, me problem came of i dont wait all file be uploaded, locally works cause instantally files uploaded, but in server not is instantally. So to solve my problem i needed use await and promisses to wait the files and after that e call the backend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文