Getting an error: "Failed to find Server Action "4a68...". This request might be from an older or newer deployment." #58431
Replies: 50 comments 46 replies
-
|
Getting the same in local dev on 14.0.0 up to 14.0.5 canary 5 for any server action which is triggered from client component. Working: Doesnt work: |
Beta Was this translation helpful? Give feedback.
-
|
@leerob this seems to be a problem, but we don't have the ability to make a repro repo because it requires multiple deployments to reproduce. can you please look into this or address? |
Beta Was this translation helpful? Give feedback.
-
|
I am experiencing the same problem as well. In my application if I log out in one tab and then trigger a server action in the other tab I get this error every time. |
Beta Was this translation helpful? Give feedback.
-
|
I also got this now using next 14.0.4. For me it happens when the server actions is called from an parallel intercepted route. The exact same code works fine from the actual route. |
Beta Was this translation helpful? Give feedback.
-
|
In my case it happens when trying to redirect on successfully submitted form. where: error: By the way, anyone has an approach to onFormSubmission side effects, and is willing to share? I am working with native useFormState, gave it a ride, and it's missing a bit in flexibility or I can't wrap my head around on Next.js 14 specifics yet EDIT: EDIT2: |
Beta Was this translation helpful? Give feedback.
-
|
I'm getting the same error. The full error message: Error: Failed to find Server Action "ff338b32de2c62c9fce3998a34545a3e0672f704". This request might be from an older or newer deployment. Original error: Invariant: Couldn't find action module ID from module map.The stack I'm using: It happens whenever the user's JWT token expires and Tanstack Query tries to refetch the data on the background. All of my query/mutation functions are Server Actions. In them, I have this code running before actually fetching anything: // serverAuth lives in another file
export const serverAuth = async () => await getServerSession(authOptions);
// actual Server Action
'use server';
const getUnitPractitioners = () => {
const session = await serverAuth();
if (!session) {
LOG.error('🚨 No session found when fetching practitioners for this unit');
return Promise.reject(
'No session found when fetching practitioners for this unit'
);
}
// does whatever action is necessary
return data;
} |
Beta Was this translation helpful? Give feedback.
-
|
I'm experiencing the same issue |
Beta Was this translation helpful? Give feedback.
-
|
Same issue on both stable and canary releases for Re-echoing that it appears to occur when using the Client Components data fetching paradigm. |
Beta Was this translation helpful? Give feedback.
-
|
I have same problem. old code: image |
Beta Was this translation helpful? Give feedback.
-
|
Same issue here. Happens when i reopen intercepted modal window that uses server actions in client components using browser navigation. |
Beta Was this translation helpful? Give feedback.
-
|
Same issue here. |
Beta Was this translation helpful? Give feedback.
-
|
Same here "next": "^14.1.0", Error: Failed to find Server Action "572c475e1c59eeb141374e2737137c179e2063dc".
This request might be from an older or newer deployment. Original error: Invariant: Couldn't find action module ID from module map.
at t3 (/.../node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:1693)
at /.../node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7079
at AsyncLocalStorage.run (node:async_hooks:338:14) |
Beta Was this translation helpful? Give feedback.
-
|
Any updates facing same issue ? |
Beta Was this translation helpful? Give feedback.
-
|
I get a similar error when I use react-email... |
Beta Was this translation helpful? Give feedback.
-
|
I have this exact same issue. |
Beta Was this translation helpful? Give feedback.
-
|
At least for me, was still broken with 14.2.9 but now issue is fixed with 14.2.10. |
Beta Was this translation helpful? Give feedback.
-
|
We released v14.2.10 with the fix, could you upgrade to the latest version and verify if that fixed for you? 🙏 Thanks |
Beta Was this translation helpful? Give feedback.
-
|
I encountered the same issue. I was importing my server action using an absolute path, but switching to a relative import resolved the problem |
Beta Was this translation helpful? Give feedback.
-
|
If you still encounter it with latest Next.js version, please file an issue with reproduction, we can help take a look on it! 🙏 |
Beta Was this translation helpful? Give feedback.
-
|
I installed 14.2.10 and I'm still getting Scenario: a user opens a tab, and then the server has a new deployment while the tab is not refreshed i.e. it becomes outdated / stale; in this case if the user Submit (with server action) using the stale client, the server action returns I tried this pattern: import server actions using relative path in a server component, and pass it as a prop to a client component, but it does not work Referenced from #58431 (reply in thread) and #58431 (comment) The specific behavior on my un-refreshed tab is: when clicking Submit, it fired a POST server action with header So from the Dev console we can see an uncaught error saying "reading xxx from undefined", also the user would see no changes from the page (because the response seems to be the exact HTML structure of the current page). In this case if the user chooses to refresh the tab, then it can work, but not every time the users are aware of this, obviously. So I'm wondering how can I maybe detect this kind of response (server action returning |
Beta Was this translation helpful? Give feedback.
-
|
from the nextjs docs: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#security:~:text=However%2C%20for%20this,a%20specific%20build. If this is the constraint, we can work around this by having an api route serve the build id to the frontend, and the frontend can poll for the build id. If it sees any changes, we can ask the user to refresh the page |
Beta Was this translation helpful? Give feedback.
-
|
This feature of generating new "unguessable, non-deterministic IDs" for server actions on every build is ruining the ability to continuously deploy my application. I don't want to force my users to refresh their browsers every time I do a deploy. What's the solution for self-hosters? Can this feature be turned off? |
Beta Was this translation helpful? Give feedback.
-
|
We are self-hosting Next.js on Cloud Run. We have set the NEXT_SERVER_ACTIONS_ENCRYPTION_KEY, but that made no difference. This error is still popping up all the time. Is there anything that can be done? |
Beta Was this translation helpful? Give feedback.
-
|
I toggled client component to the server component (APP CRASHED) and to the client component again (!!) and everything had been OK. |
Beta Was this translation helpful? Give feedback.
-
|
We have set the NEXT_SERVER_ACTIONS_ENCRYPTION_KEY but still we run into |
Beta Was this translation helpful? Give feedback.
-
|
Also running into this on 14.2.33, after switching to a standalone build. What is the deal with this? This is severely breaking our UX. |
Beta Was this translation helpful? Give feedback.
-
|
Currently facing this issue on 15.1.4, hosting in Docker on ECS |
Beta Was this translation helpful? Give feedback.
-
|
For me it was a browser issue. Hard reloading the browser, worked just fine. |
Beta Was this translation helpful? Give feedback.
-
|
Store `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY`| `next-server-actions-key`- Key
used by Next.js Server Actions for signing/encryption purposes. The docker
deployment script automatically creates this secret if it doesn't exist, or
adds a new version and destroys old enabled versions if it does exist, to
manage costs and secret history. Using GCP was temperamental but once you
get it going you can work out many errors like this.
My application works without having that error after updates.
this is an EXAMPLE flow:
function Generate-EncryptionKey {
try {
$key = & openssl rand -base64 32
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($key)) {
throw "OpenSSL command failed"
}
return $key
}
catch {
Write-Host "OpenSSL not found or command failed. Generating
fallback key using .NET..." -ForegroundColor Yellow
# Fallback to .NET for key generation
$rng = New-Object
System.Security.Cryptography.RNGCryptoServiceProvider
$bytes = New-Object byte[] 32
$rng.GetBytes($bytes)
return [Convert]::ToBase64String($bytes)
}
}
Write-Host "=== Direct Fix for Server Actions Encryption Key in Cloud Run
===" -ForegroundColor Cyan
$encryptionKey = Generate-EncryptionKey
Write-Host "Generated new encryption key" -ForegroundColor Green
Write-Host "Updating Secret Manager with new encryption key..."
-ForegroundColor Cyan
try {
$secretExists = $null
try {
$secretExists = & gcloud secrets describe $SECRET_NAME
--project=$PROJECT_ID 2>$null
} catch {}
if ($secretExists) {
$encryptionKey | gcloud secrets versions add $SECRET_NAME
--data-file=- --project=$PROJECT_ID
Write-Host "Updated Secret Manager with new key version"
-ForegroundColor Green
} else {
$encryptionKey | gcloud secrets create $SECRET_NAME --data-file=-
--project=$PROJECT_ID
Write-Host "Created new secret in Secret Manager" -ForegroundColor
Green
}
} catch {
Write-Host "Error updating Secret Manager: $_" -ForegroundColor Red
exit 1
}
$serviceAccount = & gcloud run services describe $SERVICE_NAME
--region=$REGION --format="value(spec.template.spec.serviceAccountName)"
--project=$PROJECT_ID 2>$null
if (-not $serviceAccount) {
Write-Host "Warning: Could not determine service account for Cloud Run
service" -ForegroundColor Yellow
$serviceAccount = ***@***.***"
Write-Host "Using default compute service account: $serviceAccount"
-ForegroundColor Yellow
}
Write-Host "Granting service account access to the secret..."
-ForegroundColor Cyan
gcloud secrets add-iam-policy-binding $SECRET_NAME `
--member="serviceAccount:$serviceAccount" `
--role="roles/secretmanager.secretAccessor" `
--project=$PROJECT_ID
Write-Host "Updating Cloud Run service to use secret..." -ForegroundColor
Cyan
$secretsCommand = "gcloud run services update $SERVICE_NAME
--region=$REGION --project=$PROJECT_ID
--set-secrets=""NEXT_SERVER_ACTIONS_ENCRYPTION_KEY=$SECRET_NAME`:latest"""
Write-Host "Executing command: $secretsCommand" -ForegroundColor Yellow
Invoke-Expression $secretsCommand
Write-Host "Adding build time env var for encryption key..."
-ForegroundColor Cyan
$envVarCommand = "gcloud run services update $SERVICE_NAME --region=$REGION
--project=$PROJECT_ID
--update-env-vars=""NEXT_SERVER_ACTIONS_ENCRYPTION_KEY_BUILD_TIME=$encryptionKey"""
Invoke-Expression $envVarCommand
Write-Host "Verifying service configuration..." -ForegroundColor Cyan
$updatedService = gcloud run services describe $SERVICE_NAME
--region=$REGION --format="json" --project=$PROJECT_ID | ConvertFrom-Json
$hasEncryptionKey = $false
if ($updatedService.spec.template.spec.secrets) {
foreach ($secret in $updatedService.spec.template.spec.secrets) {
if ($secret.name -eq "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY") {
$hasEncryptionKey = $true
break
}
}
}
if ($hasEncryptionKey) {
Write-Host "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY is now properly set in
Cloud Run" -ForegroundColor Green
} else {
Write-Host " Failed to set NEXT_SERVER_ACTIONS_ENCRYPTION_KEY in Cloud
Run" -ForegroundColor Red
}
$serviceUrl = & gcloud run services describe $SERVICE_NAME --region=$REGION
--format="value(status.url)" --project=$PROJECT_ID
Write-Host "=================================================="
-ForegroundColor Green
Write-Host "Server Actions Encryption Key fix completed!" -ForegroundColor
Green
Write-Host "The encryption key has been:" -ForegroundColor Green
Write-Host "1. Generated with a new secure value" -ForegroundColor Green
Write-Host "2. Updated in Secret Manager" -ForegroundColor Green
Write-Host "3. Properly configured in Cloud Run service" -ForegroundColor
Green
Write-Host "" -ForegroundColor Green
Write-Host "Now you need to redeploy the service using:" -ForegroundColor
Yellow
Write-Host "./easy-deploy.ps1" -ForegroundColor Yellow
Write-Host "" -ForegroundColor Green
Write-Host "Your application is available at: $serviceUrl" -ForegroundColor
Cyan
Write-Host "=================================================="
-ForegroundColor Green
…On Thu, Nov 20, 2025 at 3:36 PM Mark Edwards ***@***.***> wrote:
I think you might misunderstand. That's exactly what's being complained
about here. The app should continue working without the user refreshing.
—
Reply to this email directly, view it on GitHub
<#58431 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALPROIASVEOH3IYVZCI6GJ335YX7HAVCNFSM6AAAAAA7K2MJBKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTKMBTGIYTSOI>
.
You are receiving this because you were mentioned.Message ID: <vercel/next
.***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
I feel like for me the issue is that there's other stuff running on the ECS, and whenever those get deployed, they restart Next.js application, which seems to break Server Actions. Might be wrong though. Basically, Next.js needs like ideal environment with nothing interrupting it. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
I recently deployed an App dir 14.0.1 Nextjs application and have several users using it at my company. It uses server actions heavily. This AM i started getting some errors in Sentry:
My assumption is that my users haven't refreshed their browser since I pushed out some changes.
Anyone ever seen anything like this? Any ideas or tips? Should I push out some change that makes users refresh when a new release is out?
Beta Was this translation helpful? Give feedback.
All reactions