silverwolf-x/project / errors /failed-to-find-server-action.mdx
silverwolf-x's picture
download
raw
1.48 kB
---
title: Failed to find Server Action
---
## Why This Message Occurred
For security purposes, Next.js creates encrypted, non-deterministic keys (IDs) to allow for the client to reference and call the [Server Action](/docs/app/getting-started/mutating-data). These keys are periodically recalculated between builds for enhanced security.
When self-hosting your Next.js application across multiple servers, each server instance may end up with a different encryption key, leading to potential inconsistencies.
## Possible Ways to Fix It
To mitigate this, you can overwrite the encryption key using the `process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` environment variable. Specifying this variable ensures that your encryption keys are persistent across builds, and all server instances use the same key.
The key must be a base64-encoded value with a valid AES key length (16, 24, or 32 bytes). Set this variable at **build time**—the key is embedded in the build output and used automatically at runtime.
If you are deploying your Next.js application to Vercel, you can use the feature [Skew Protection](https://vercel.com/docs/deployments/skew-protection) to ensure assets and functions from the previous version are still available, even after a new version is deployed.
## Useful Links
- [Server Actions - Security](/docs/app/guides/data-security)
- [Overwriting encryption keys (advanced)](/docs/app/guides/data-security#overwriting-encryption-keys-advanced)

Xet Storage Details

Size:
1.48 kB
·
Xet hash:
9b56bc8478771e8732da1a59ea71f0c2afceaa299221f592f391adfd2e912f82

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.