-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Bug: Telegram integration fails with TypeError: fetch failed from Node.js process, but curl works from shell
Environment
- Moltworker: Deployed via "Deploy to Cloudflare" button
- OpenClaw version: 2026.2.17 (upgraded from 2026.2.3 — same behavior on both)
- Container: Cloudflare Sandbox (
standard-1) - Secrets configured:
TELEGRAM_BOT_TOKEN,ANTHROPIC_API_KEY,MOLTBOT_GATEWAY_TOKEN,CF_ACCESS_AUD,CF_ACCESS_TEAM_DOMAIN,CF_ACCOUNT_ID,R2_ACCESS_KEY_ID,R2_SECRET_ACCESS_KEY,CDP_SECRET,WORKER_URL,DEBUG_ROUTES=true
Description
Telegram channel shows as configured and enabled in the gateway config, and the bot token is valid. However, the grammy library's getUpdates polling fails continuously with TypeError: fetch failed from Node's built-in undici fetch.
The key finding: Running curl to api.telegram.org from within the container shell works — messages are successfully sent. But the Node.js gateway process cannot make outbound HTTP requests to Telegram's API.
This suggests the Cloudflare Sandbox/Firecracker environment has different network access rules for the Node.js process vs. shell commands.
Steps to Reproduce
- Deploy Moltworker via the "Deploy to Cloudflare" button
- Set
TELEGRAM_BOT_TOKENsecret with a valid bot token from @Botfather - Restart the gateway
- Send a message to the bot on Telegram
- Observe no response; check debug logs
Expected Behavior
Telegram bot receives and responds to messages.
Actual Behavior
Gateway starts and recognizes Telegram config:
[telegram] [default] starting provider (@claw_gpolzer_bot)
[telegram] autoSelectFamily=false (default-node22)
Then immediately begins failing with repeated fetch errors:
[openclaw] Non-fatal unhandled rejection (continuing): TypeError: fetch failed
at node:internal/deps/undici/undici:13502:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
With periodic Telegram-specific errors:
[telegram] network error: Network request for 'getUpdates' failed!; retrying in 2.16s.
[telegram] network error: Network request for 'getUpdates' failed!; retrying in 4.49s.
These errors repeat indefinitely every ~10 seconds.
Diagnostic Evidence
OpenClaw's own status check reports Telegram as healthy:
│ Telegram │ ON │ OK │ token config (8243…MWJk · len 46) · accounts 1/1
But sending a message via curl from the container shell succeeds:
OpenClaw was able to run curl to api.telegram.org/bot<token>/sendMessage and the message was delivered to Telegram. This confirms:
- The bot token is valid
- The container can reach
api.telegram.orgvia shell commands - The issue is specific to Node.js
fetch()/ undici within the gateway process
Possible Cause
The Cloudflare Sandbox (Firecracker) environment may apply different network isolation rules to the main Node.js process vs. child processes / shell commands. The grammy library uses Node's built-in fetch (undici), which may be subject to stricter networking constraints in the sandbox.
Workaround
None found. The Control UI (WebSocket-based) works correctly for all interactions — only external API calls from the Node.js process are affected. This likely also impacts Discord and Slack integrations.