debug: add webhook body logging

This commit is contained in:
admin
2026-05-05 13:31:25 +00:00
Unverified
parent bd26de66dd
commit 4094f4b3eb

View File

@@ -491,6 +491,11 @@ export async function initBot(config, api, tools, skills, agents) {
app.post('/telegram/webhook', async (req, res) => { app.post('/telegram/webhook', async (req, res) => {
res.json({ ok: true }); // ack immediately res.json({ ok: true }); // ack immediately
try { try {
logger.info('📥 Webhook received:', {
update_id: req.body?.update_id,
has_message: !!req.body?.message,
type: req.body?.message?.text ? 'text' : 'other'
});
await bot.handleUpdate(req.body); await bot.handleUpdate(req.body);
} catch (e) { } catch (e) {
logger.error('Webhook update error:', { logger.error('Webhook update error:', {
@@ -498,7 +503,8 @@ export async function initBot(config, api, tools, skills, agents) {
name: e.name, name: e.name,
stack: e.stack, stack: e.stack,
body: req.body?.update_id, body: req.body?.update_id,
full: e.toString() full: e.toString(),
body_preview: req.body ? JSON.stringify(req.body).substring(0, 200) : 'no body'
}); });
} }
}); });