Troubleshooting
| Problem | Solution |
|---|---|
| Bot doesn’t respond | Check webhook is set: https://api.telegram.org/bot<TOKEN>/getWebhookInfo |
| 500 errors in logs | Check Workers & Pages > Logs in Cloudflare dashboard |
| D1 errors | Verify the schema was applied: npx wrangler d1 execute telegram-bot-db --remote --command="SELECT name FROM sqlite_master" |
| Cron not firing | Confirm it shows under Triggers > Cron Triggers in the dashboard |
| Inline queries not working | Ensure inline mode is enabled via @BotFather using /setinline |
Common Issues
Webhook Not Registered
If the bot doesn’t respond at all, the webhook might not be set. Visit your worker URL with /setup appended:
https://your-worker-url.workers.dev/setup
You should see "ok": true in the response.
Database Not Initialized
If you see D1-related errors, make sure the schema has been applied:
npm run db:init:remote
Bot Token Invalid
If you get authentication errors, verify your bot token is correct:
npx wrangler secret put BOT_TOKEN
Channel ID Wrong Format
Channel IDs are negative numbers starting with -100. Make sure you’re using the full numeric ID, not the channel username.