fix: skip express.json for stripe webhook to preserve raw body
This commit is contained in:
parent
955da8899b
commit
8fdcb65f4b
|
|
@ -109,7 +109,13 @@ async function createSessionJWT(userId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.json({ limit: '10mb' }));
|
// Stripe Webhook は raw body が必要なため、webhook パスのみ json パースをスキップ
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.path === '/brain/api/stripe/webhook' || req.path === '/api/stripe/webhook') {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
express.json({ limit: '10mb' })(req, res, next);
|
||||||
|
});
|
||||||
|
|
||||||
// ── CORS ──────────────────────────────────
|
// ── CORS ──────────────────────────────────
|
||||||
// ALLOWED_ORIGINS 環境変数(カンマ区切り)+ 開発用ローカル
|
// ALLOWED_ORIGINS 環境変数(カンマ区切り)+ 開発用ローカル
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue