Compilation error when trying to use server actions (turbopack? | nextjs?)
Answered
Losti! posted this in #help-forum
Losti!OP
Compilation error when trying to use server actions (turbopack? |
nextjs?)
Hey guys, I'm recently trying to finish the authentication in my project and I've been having a lot of problems when implementing server actions recently.
When using a server action, my application automatically crashes and there's no way to fix it unless I delete the server actions and their use in my components. Currently the only thing that works for me are the Api routes.
I'll leave the error output right here and a screenshot of the error in the browser.
dependencies:
(others omitted to simplify it)
I have been having this problem for days and it prevents me from logging in with next-auth v5.
Thanks for the help in advance.
nextjs?)
Hey guys, I'm recently trying to finish the authentication in my project and I've been having a lot of problems when implementing server actions recently.
When using a server action, my application automatically crashes and there's no way to fix it unless I delete the server actions and their use in my components. Currently the only thing that works for me are the Api routes.
I'll leave the error output right here and a screenshot of the error in the browser.
╭─[~/projects/arty]─[lost@Kokoro]─[0]─[2750]
╰─[:)] % bun run dev
$ next dev --turbopack
Using existing cloned repo
⠹ ▲ Next.js 15.2.1 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.18.17:3000
- Environments: .env
- Experiments (use with caution):
· turbo
✓ authInterrupts
✓ Starting...
ℹ [paraglide] Compiling inlang project at "./project.inlang".
Using existing cloned repo
✓ Compiled in 4.6s
✓ Ready in 5.4s
○ Compiling / ...
✓ Compiled / in 1229ms
⨯ ./.next-internal/server/app/(main)/page/actions.js
ModuleId not found for ident: "[project]/.next-internal/server/app/(main)/page/actions.js [app-rsc] (server actions loader, ecmascript)"
ModuleId not found for ident: "[project]/.next-internal/server/app/(main)/page/actions.js [app-rsc] (server actions loader, ecmascript)"
✓ Compiled /_error in 418ms
GET / 500 in 1757ms
dependencies:
"next": "^15.2.1" | "v15.2.2-canary4",
"next-auth": "^5.0.0-beta.25",
"next-themes": "^0.4.4",
"react": "19.0.0",
"react-dom": "19.0.0",
"@auth/drizzle-adapter": "^1.8.0",
(others omitted to simplify it)
I have been having this problem for days and it prevents me from logging in with next-auth v5.
Thanks for the help in advance.
Answered by Losti!
Hi guys, I've been looking through my project code and noticed that my turbopack was configured with:
ExperimentalTurboOptions.moduleIdStrategy?: "named" | "deterministic" | undefined
When I remove this configuration from my project, the server runs as expected.
ExperimentalTurboOptions.moduleIdStrategy?: "named" | "deterministic" | undefined
When I remove this configuration from my project, the server runs as expected.
3 Replies
Losti!OP
Other details:
- I checked the .next build directory for the actions.js and as far as the file is concerned I haven't found it in the build so far.
- I changed the version to canary several times and went back to 15.2.1 stable and the problem continues.
- At one point the server actions worked for me but then the problem comes back and there is no way to solve it.
- My application works perfectly, I have been testing before re-implementing a server action for the user's login and when I implemented it in the form the problem returned.
- I checked the .next build directory for the actions.js and as far as the file is concerned I haven't found it in the build so far.
- I changed the version to canary several times and went back to 15.2.1 stable and the problem continues.
- At one point the server actions worked for me but then the problem comes back and there is no way to solve it.
- My application works perfectly, I have been testing before re-implementing a server action for the user's login and when I implemented it in the form the problem returned.
I think it's mostly a compilation error in turbopack or next.js in recent versions, but when searching I couldn't find any kind of issue related to my problem in question (in case I'm wrong and this problem has already been discussed, please let me know).
Losti!OP
Hi guys, I've been looking through my project code and noticed that my turbopack was configured with:
ExperimentalTurboOptions.moduleIdStrategy?: "named" | "deterministic" | undefined
When I remove this configuration from my project, the server runs as expected.
ExperimentalTurboOptions.moduleIdStrategy?: "named" | "deterministic" | undefined
When I remove this configuration from my project, the server runs as expected.
Answer