grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.04k stars 106 forks source link

HttpError: Network request for 'sendMessage' failed! #585

Closed ssyijiu closed 2 months ago

ssyijiu commented 2 months ago
HttpError: Network request for 'sendMessage' failed!
    at /Users/kuigas/code/web3wool.js/node_modules/grammy/out/core/error.js:74:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ApiClient.call (/Users/kuigas/code/web3wool.js/node_modules/grammy/out/core/client.js:54:29)
    at async ApiClient.callApi (/Users/kuigas/code/web3wool.js/node_modules/grammy/out/core/client.js:86:22)
    at async botManager (file:///Users/kuigas/code/web3wool.js/src/com.shusheng.wool/bot/bot-manager.mjs:39:5)
    at async file:///Users/kuigas/code/web3wool.js/src/com.shusheng.wool/bot/bot-manager.mjs:263:1 {
  error: FetchError: request to https://api.telegram.org/bot7016864620:AAFMQ6QyZQUHnQW_rCGgxR39hBKZYUSypAE/sendMessage failed, reason: connect ETIMEDOUT 2001:67c:4e8:f004::9:443
      at ClientRequest.<anonymous> (/Users/kuigas/code/web3wool.js/node_modules/node-fetch/lib/index.js:1501:11)
      at ClientRequest.emit (node:events:514:28)
      at TLSSocket.socketErrorListener (node:_http_client:501:9)
      at TLSSocket.emit (node:events:514:28)
      at emitErrorNT (node:internal/streams/destroy:151:8)
      at emitErrorCloseNT (node:internal/streams/destroy:116:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    type: 'system',
    errno: 'ETIMEDOUT',
    code: 'ETIMEDOUT'
  }
}

Node.js v18.17.1
ssyijiu commented 2 months ago

It was indeed an issue with the connection from my machine.

Recently I detatched the machine’s IPv6, so it works with IPv4 only.

It seems n8n can’t connect to Telegram without IPv6.

Do you know a workaround which could help me working with the Telegram app without IPv6?

Cheers!

KnorpelSenf commented 2 months ago

I don't know any way to do this, perhaps @roj1512 or @KnightNiwrem do?

Remember to revoke the token you just leaked. Everybody can control https://t.me/shushengManagerBot until you do.

KnightNiwrem commented 2 months ago

@ssyijiu You can try node --dns-result-order=ipv4first <your file>.