-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
Summary
Telegram bot integration fails to connect with continuous TypeError: fetch failed errors from undici. Bot token is valid and verified working via curl and Node.js native https module, but OpenClaw's Telegram channel cannot connect to api.telegram.org.
Steps to reproduce
- Install OpenClaw 2026.1.30 on Ubuntu 24.04.3 LTS VPS with Node.js 22.22.0
- Configure Telegram bot with valid token in
~/.openclaw/openclaw.json - Start gateway:
openclaw gateway start - Send message to bot (@Marcoboto2bot)
- Observe bot never responds and logs show continuous fetch failures
Expected behavior
Telegram bot should successfully connect to api.telegram.org, receive messages via getUpdates, and respond to user messages.
Actual behavior
OpenClaw logs show continuous network errors:
error gateway/channels/telegram Telegram network error: Network request for 'getUpdates' failed!
warn [openclaw] Non-fatal unhandled rejection (continuing): TypeError: fetch failed
at node:internal/deps/undici/undici:14902:13
Bot never receives or responds to messages. Channel status shows "OK" but communication fails.
Environment
- OpenClaw version: 2026.1.30 (76b5208)
- OS: Ubuntu 24.04.3 LTS (VPS)
- Node.js: v22.22.0
- Install method: npm global install
Logs or screenshots
OpenClaw logs showing repeated failures:
18:20:18 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} Telegram network error: Network request for 'getUpdates' failed!; retrying in 2.29s.
18:20:18 warn [openclaw] Non-fatal unhandled rejection (continuing): TypeError: fetch failed
at node:internal/deps/undici/undici:14902:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
Verification that token works with curl (returns 200):
$ curl https://api.telegram.org/bot8480442785:AAFe6zrM9sYrB_9GaUOY3L0ONTj7Fn542YY/getMe
{"ok":true,"result":{"id":8480442785,"is_bot":true,"first_name":"Marco Boto","username":"Marcoboto2bot"...}}Verification that Node.js native https module works:
$ node -e "const https = require('https'); https.get('https://api.telegram.org/bot[TOKEN]/getMe', (res) => { console.log('Status:', res.statusCode); });"
Status: 200Config shows correct token:
"channels": {
"telegram": {
"enabled": true,
"botToken": "8480442785:AAFe6zrM9sYrB_9GaUOY3L0ONTj7Fn542YY"
}
}Troubleshooting attempted:
- Disabled IPv6 system-wide:
sysctl net.ipv6.conf.all.disable_ipv6=1 - Set
NODE_OPTIONS=--dns-result-order=ipv4firstin systemd service - Verified no firewall blocking (iptables OUTPUT policy ACCEPT)
- Confirmed curl and Node https both connect successfully
Analysis:
This appears to be a compatibility issue between Node.js 22's undici fetch module and certain VPS network configurations. Native Node.js https works, but undici fails. May be related to PR #7195 which addresses Telegram Grammy HttpError network failures.
Suggested fix: Implement fallback to native http/https module when undici fetch fails, or add better error detection/handling for VPS environments where undici doesn't work.