-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build error "Cannot get final name for export '<export_name>'" when using server actions a certain way #60807
Comments
maybe related to #58756 |
Seems to occur when importing certain (?) packages (for me, it was heroicons) into a component that was using |
@skve You mean that this is an additional way to reproduce right? Because I am not using any imported client components from a package in my example. It would help if you could create a reproduction repo of this too. |
I'm experiencing a similar error: I'm importing a server action in a client component. Everything marked as use server/client appropriately. When I remove this block from my server action, the build succeeds.
This code is recommended by AWS Amplify in a SSR environment. Related: aws-amplify/amplify-js#12856 |
Same issue here with |
Same issue as @gavacq. Its coming after adding AWS Amplify in SSR. Any resolution ? |
This is what worked for me: Edit: The build error is gone but now I am getting this error while calling the fetchAuthSession method Attempted to get the Amplify Server Context that may have been destroyed. |
Ultimately its not working as expected, did anyone find a solution for this ? |
For me, this issue occurred because of a circular dependency issue using barrel files. Once I changed my import from the index.ts (barrel file) to the actual file - the issue resolved. |
I ran into the same issue, i was importing some utils. but read up on this in the docs...The arguments and return value of Server Actions must be serializable by React. See the React docs for a list of serializable arguments and values |
@gavacq's method of switching to Perhaps there is a logging error that would help us provide more data? The issue seems related to project structure so duplicating that may be tough otherwise. |
For me, this happened when importing a turborepo package into a server action. |
There might be something here. For me it's happening when importing NX packages. I'm also having a bizarre issue where at runtime the server action suddenly can't find the function: #63591 Overall, it feels like we just need more transparency into what is happening in the server action build process. As edge case build issues seem to be at the root of all of these server action issues. |
I've found a solution here worked for me: #59344 (comment) |
The goat |
helped much! In my case it was only needed to put the |
Does anyone have this error with the openai package?
|
I had the same issue with openai (via langchain). Adding I'm guessing Thank you @harryhaibojiang! |
I got a similar error and I'm able to reproduce this. Please check my repo https://github.com/tanapoln/nextjs-build-error Still don't know how to fix it. |
It's working for me with Next 15.0.0-canary.25+, so waiting for a stable version. |
@Alex01d Thanks for the info! I just checked and it is also working with Thank you for all the workarounds, I am closing this for now. |
Hi @Alex01d when you say it's working, you meant it worked without specifying the |
For me it is working without specifying it in |
I had this issue with 2 imports: 'jose' and 'next/navigation'. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/mkreuzmayr/next-server-action-bug-repro/
To Reproduce
Run
pnpm build
to reproduce the following errorExplanation:
The file
src/server/auth/keycloak.ts
is imported in throughsrc/server/auth/index.ts
into the server actionsrc/server/actions/test.ts
.I am unsure how and why this happens but there are two unrelated things I found you can do to make the error go away.
src/server/actions/test.ts
is imported. Removing the trailing underscore fromapp/test2/_page.tsx
makes the error go away.src/server/auth/index.ts
also makes the error go away.Current vs. Expected behavior
Building the next app raises an error when it should actually build the app as normal.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Module resolution (CJS / ESM, module resolving)
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
The bug still exists on 14.0.5-canary.65
The text was updated successfully, but these errors were encountered: