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

crashing #1

Open
tazhate opened this issue Sep 14, 2017 · 5 comments
Open

crashing #1

tazhate opened this issue Sep 14, 2017 · 5 comments

Comments

@tazhate
Copy link

tazhate commented Sep 14, 2017

events.js:160
throw er; // Unhandled 'error' event
^
NetworkError: Error: connect ETIMEDOUT 149.154.167.197:443
at NetworkError.Error (native)
at new NetworkError (/root/shell-bot/node_modules/botgram/lib/bot.js:21:20)
at ClientRequest.handleResponse (/root/shell-bot/node_modules/botgram/lib/bot.js:129:24)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

@mildsunrise
Copy link
Member

mildsunrise commented Sep 16, 2017

This literally means the bot can't connect to Telegram. Do you still get this error? Is internet working from that machine? Verify your network settings.

Also, please post the output of curl -v https://api.telegram.org (again, in that same machine)

@tazhate
Copy link
Author

tazhate commented Sep 16, 2017

I know it, but why it is crashing? I think that bot should try to reconnect instead of crash :) Sometimes servers get lost of connectivity, so bot should be able to handle this kind of situations.

@mildsunrise
Copy link
Member

This is true. The latest (unreleased ATM) Botgram retries most requests without failing, so as long as you're not using your bot when Telegram servers crash, it will keep running.

However, there's still a lot of corner situations that I don't know how to handle (Telegram API unreachable, message limit exceeded, ...) so I always recomment running the bot with a respawner.

@3guboff
Copy link

3guboff commented Nov 21, 2017

Hello, same crash:

2017-11-19 20:55 +03:00: NetworkError: Error: connect ECONNREFUSED 149.154.167.197:443
    at new NetworkError (/home/services/telegram-shell/current/node_modules/botgram/lib/bot.js:21:20)
    at ClientRequest.handleResponse (/home/services/telegram-shell/current/node_modules/botgram/lib/bot.js:129:24)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

@mildsunrise
Copy link
Member

That's probably because your Internet is momentarily failing, or Telegram's API is down (which happens a lot lately). If you get NetworkError: API response not in JSON then Telegram is answering requests with 502 errors:

HTTP/1.1 502 Bad Gateway
Server: nginx/1.12.2
Date: Fri, 08 Dec 2017 01:12:17 GMT
Content-Type: text/html
Content-Length: 173
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>

The last (still unreleased) version of Botgram will avoid most crashes when any of these issues happen. But I'll still recommend using a respawner.

Apon77 pushed a commit to Apon77/shell-bot that referenced this issue Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants