Files
gitlab-instance-0a899031_no…/scripts/generate-encryption-key.js
2026-03-12 04:05:58 -05:00

14 lines
530 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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);