Getting an error: "Failed to find Server Action "4a68...". This request might be from an older or newer deployment." #58431
Replies: 41 comments 22 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.
-
Yeah honestly I would recommend just use TRPC for all of your server calls. It will create api routes for all of them. APi routes are just more stable and predictable
Sent from [Proton Mail](https://proton.me/mail/home) for iOS
…On Sat, May 11, 2024 at 9:30 AM, Nguyen Minh Tuan ***@***.***(mailto:On Sat, May 11, 2024 at 9:30 AM, Nguyen Minh Tuan <<a href=)> wrote:
I have an issue "failed to find server action".before it logs the error, i can call server actions 2 times and it's dies when trigger the 3rd time, idk why
—
Reply to this email directly, [view it on GitHub](#58431 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AH3JIEXMP5KXURCC6HQI25TZBZBQTAVCNFSM6AAAAAA7K2MJBKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGOJXGAYDI).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello, for anyone that may encounter similar problem - in my case it was dynamic og-image generation that caused "Failed to find server action" error. NextJS changed package name from "next/server" to "next/og". That small change fixed error for my use case with dynamic opengraph. From: I hope it saves someone's time. Cheers |
Beta Was this translation helpful? Give feedback.
-
This error happens to me when I call a server action in my useEffect in a client component, and do a client-side navigation to another page before the server action finishes. This results in the client receiving For now I will just validate that the server action responds a valid value, but I still find no solution for the server side. |
Beta Was this translation helpful? Give feedback.
-
in my case, upgrading the version of error message
before
after
|
Beta Was this translation helpful? Give feedback.
-
Any update on this? |
Beta Was this translation helpful? Give feedback.
-
Following: #69547
I tried the versions on the example here
And I ran into similar issues, I also found literally impossible to use server actions inside client components to fetch data. None of the methods I used before worked for me, and I get no proper error/warning so I have no clue. Tried:
All methods that I used previously and worked to some degree failed, so I have no idea how to use server actions from client components as of now. |
Beta Was this translation helpful? Give feedback.
-
I’m also seeing this error appear on 14.2.8, even when on the latest deployment |
Beta Was this translation helpful? Give feedback.
-
#69788 now merged to fix the issue that was introduced in 14.2.8 |
Beta Was this translation helpful? Give feedback.
-
I'm observing this issue with 14.2.9 |
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.
-
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