From 10c614fc8c5eba5dc0b02821da85e511e164e0f2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 12 Jun 2026 23:46:55 -0400 Subject: [PATCH] debug: add trace logs to onParse and webhook handler --- apps/backend/src/index.ts | 5 ++++- apps/backend/src/routes/line.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/index.ts b/apps/backend/src/index.ts index 864d6cf..10dced6 100644 --- a/apps/backend/src/index.ts +++ b/apps/backend/src/index.ts @@ -30,8 +30,11 @@ const JWT_SECRET = process.env.JWT_SECRET || "homaroma_secret_2026_scent"; const app = new Elysia() .onParse(async ({ request }) => { + console.log('[onParse] Incoming request URL:', request.url); if (request.url.includes('/api/line/webhook')) { - return await request.text(); + const text = await request.text(); + console.log('[onParse] Intercepted LINE webhook raw body length:', text.length); + return text; } }) .use( diff --git a/apps/backend/src/routes/line.ts b/apps/backend/src/routes/line.ts index 4f79f63..6454638 100644 --- a/apps/backend/src/routes/line.ts +++ b/apps/backend/src/routes/line.ts @@ -4,6 +4,9 @@ import { lineConfig, lineClient } from '../lib/lineClient'; import crypto from 'crypto'; const webhookHandler = async ({ request, body, set }: { request: Request, body: any, set: any }) => { + console.log('[LINE Webhook] Handler body type:', typeof body); + console.log('[LINE Webhook] Channel Secret configured:', !!lineConfig.channelSecret, lineConfig.channelSecret ? lineConfig.channelSecret.substring(0, 4) + '...' : 'NONE'); + // 1. Verify Signature const signature = request.headers.get('x-line-signature'); if (!signature) {