กลับหน้าแรก
Next Js 16.2.1 (ปัจจุบัน 16.2.2)  Error: Failed to find Server Action "x"
📂 Coding

Next Js 16.2.1 (ปัจจุบัน 16.2.2) Error: Failed to find Server Action "x"

Next Js 16.2.1 (ปัจจุบัน 16.2.2)
มาอีกแล้ว Error: Failed to find Server Action "x"

```javascript
Error: Failed to find Server Action "x". This request might be from an older or newer deployment.
Read more: https://nextjs.org/docs/messages/failed-to-find-server-action
    at ignore-listed frames
```

แก้ไขยังไง

1. สร้างไฟล์ .env.production ไว้ที่ Root Directory

my-next-app/
├── .env.production  <-- วางไว้ตรงนี้
├── app/
├── public/
├── package.json
└── ...
2. สร้าง key

openssl rand -base64 == จะได้ คีย์สุ่ม
3. เปิดไฟล์ .env.production 
ใส่ NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = คีย์สุ่ม
บันทึก

4. สร้าง .gitignore .dockerignore ไว้ด้วย อย่าเอาไฟล์นี้ไป
คือ ใส่ ข้อความ 

.env.production
ลงไป บันทึก เป็นอันเสร็จ

แชร์บทความนี้:

💬 ความคิดเห็น (0)

ยังไม่มีใครมาคุยด้วยเลย... เริ่มคอมเมนต์คนแรกกัน!