diff --git a/server.js b/server.js index fbd74b5b..03e504c9 100644 --- a/server.js +++ b/server.js @@ -109,7 +109,13 @@ async function createSessionJWT(userId) { } 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 ────────────────────────────────── // ALLOWED_ORIGINS 環境変数(カンマ区切り)+ 開発用ローカル