fix: 405 on write methods in Vercel (static GET optimization)

Route handlers with both GET and write methods get the GET statically
optimized on Vercel, which 405s POST/PUT/DELETE. Add
export const dynamic = 'force-dynamic' to all 7 affected routes
(settings, posts, custom-pages, event-logs, links, conversations, reports).
This commit is contained in:
lezi-fun committed 2026-08-10 11:02:11 +08:00
1 parent d1c06741f6
commit 7ce81969ac
7 files changed
+27

No files matched your search

+3
View File
@@ -2,6 +2,9 @@
import pool from '@/lib/db';
import { getUser, requireAdmin } from '@/lib/auth';
// 避免 GET 被静态优化导致 PUT 405(动态接口,不能缓存)
export const dynamic = 'force-dynamic';
export async function GET() {
try {
const r = await pool.query('SELECT key, value FROM settings');