Skip to content

Commit 3c9c25d

Browse files
fix: add logging for webhook processing and channel validation
1 parent aadfa90 commit 3c9c25d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ export function startServer(client: Client) {
6565
const payload: WebhookPayload = await c.req.json();
6666

6767
const channelId = channelMap[payload.type];
68+
logger.debug("Webhook received", { type: payload.type, channelId, cacheSize: client.channels.cache.size });
69+
6870
if (!channelId) {
6971
return c.json({ error: "No channel configured for this type" }, 400);
7072
}
7173

7274
const channel = client.channels.cache.get(channelId);
7375
if (!channel || !(channel instanceof TextChannel)) {
76+
logger.warn("Channel not found in cache", { channelId, found: !!channel, isTextChannel: channel instanceof TextChannel });
7477
return c.json({ error: "Channel not found" }, 404);
7578
}
7679

0 commit comments

Comments
 (0)