debug: add trace logs to onParse and webhook handler
This commit is contained in:
1 parent
658a08f8dc
commit
10c614fc8c
2 files changed
+7
-1
No files matched your search
@@ -30,8 +30,11 @@ const JWT_SECRET = process.env.JWT_SECRET || "homaroma_secret_2026_scent";
|
|||||||
|
|
||||||
const app = new Elysia()
|
const app = new Elysia()
|
||||||
.onParse(async ({ request }) => {
|
.onParse(async ({ request }) => {
|
||||||
|
console.log('[onParse] Incoming request URL:', request.url);
|
||||||
if (request.url.includes('/api/line/webhook')) {
|
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(
|
.use(
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import { lineConfig, lineClient } from '../lib/lineClient';
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
const webhookHandler = async ({ request, body, set }: { request: Request, body: any, set: any }) => {
|
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
|
// 1. Verify Signature
|
||||||
const signature = request.headers.get('x-line-signature');
|
const signature = request.headers.get('x-line-signature');
|
||||||
if (!signature) {
|
if (!signature) {
|
||||||
|
|||||||
Reference in new issue
Block a user