Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot keep randomly crashing #1709

Closed
0wx opened this issue Oct 1, 2022 · 3 comments
Closed

Bot keep randomly crashing #1709

0wx opened this issue Oct 1, 2022 · 3 comments
Assignees
Labels

Comments

@0wx
Copy link
Contributor

0wx commented Oct 1, 2022

My bot keep crashing randomly, tried to debug it on test but it's never fails on test.

this is the error code on production

2022-10-01T06:51:46.515767996Z app[web.1]: Error [ERR_HTTP_HEADERS_SENT]: Cannot render headers after they are sent to the client
2022-10-01T06:51:46.515773387Z app[web.1]:     at new NodeError (node:internal/errors:387:5)
2022-10-01T06:51:46.515778488Z app[web.1]:     at ServerResponse.writeHead (node:_http_server:335:13)
2022-10-01T06:51:46.515783650Z app[web.1]:     at /app/node_modules/telegraf/lib/core/network/webhook.js:48:17 {
2022-10-01T06:51:46.515788982Z app[web.1]:   code: 'ERR_HTTP_HEADERS_SENT'
2022-10-01T06:51:46.515794155Z app[web.1]: }

The bot never crash on test or when the traffic is low.

} catch (error: unknown) {
// if any of the parsing steps fails, give up and respond with error
res.writeHead(415).end()
debug('Failed to parse request body:', error)
return

This could probably because it catch error when res.end() is failing, but still trying do it again, idk.

@wojpawlik wojpawlik self-assigned this Oct 1, 2022
wojpawlik added a commit that referenced this issue Oct 1, 2022
@0wx
Copy link
Contributor Author

0wx commented Oct 1, 2022

Thanks @wojpawlik for the fast fix. Anyway when will it published on npm?

@wojpawlik
Copy link
Member

Hopefully as soon as #1690 is merged.

Install from GitHub in the meantime: npm install telegraf/telegraf#dbd83ae417dddeae1a335c242541956b5764c79c.

@MKRhere
Copy link
Member

MKRhere commented Oct 1, 2022

Released 4.10.0 including this fix.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants