This commit is contained in:
eric
2026-03-12 04:05:58 -05:00
parent 2a9bb8330c
commit 6f4e287ca3
3 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env node
/**
* 生成 Next.js Server Actions 加密密钥
* 用于解决 "Failed to find Server Action" 部署错误
*
* 用法: node scripts/generate-encryption-key.js
* 将输出的 base64 字符串设置为环境变量 NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
* 在构建时设置pnpm build 前 export 或 .env 中配置)
*/
const crypto = require("crypto");
const key = crypto.randomBytes(32).toString("base64");
console.log("将以下值设置为 NEXT_SERVER_ACTIONS_ENCRYPTION_KEY\n");
console.log(key);