[GH-ISSUE #722] Incompatible with next-safe-action #154

Closed
opened 2026-05-06 12:37:42 +02:00 by BreizhHardware · 7 comments

Originally created by @LubomirGeorgiev on GitHub (Mar 30, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/722

I am trying to use https://github.com/next-safe-action/next-safe-action with Vinext but I am getting this error

12:21:32 AM [vite] Internal server error: unsupported non async function
  Plugin: rsc:use-server
  File: /Users/[USER]/projects/vinext-nextjs/src/test.action.ts:5:0
  1  |  "use server";
  2  |  import { actionClient } from "./lib/safe-action";
  3  |  export const testAction = actionClient.action(async () => {
     |  ^
  4  |          return { message: "Hello, world!" };
  5  |  });

Steps to reproduce

  1. Clone https://github.com/LubomirGeorgiev/vinext-next-safe-action
  2. Run pnpm dev:vinext
Originally created by @LubomirGeorgiev on GitHub (Mar 30, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/722 I am trying to use https://github.com/next-safe-action/next-safe-action with Vinext but I am getting this error ``` 12:21:32 AM [vite] Internal server error: unsupported non async function Plugin: rsc:use-server File: /Users/[USER]/projects/vinext-nextjs/src/test.action.ts:5:0 1 | "use server"; 2 | import { actionClient } from "./lib/safe-action"; 3 | export const testAction = actionClient.action(async () => { | ^ 4 | return { message: "Hello, world!" }; 5 | }); ``` # Steps to reproduce 1. Clone https://github.com/LubomirGeorgiev/vinext-next-safe-action 2. Run `pnpm dev:vinext`
Author
Owner

@southpolesteve commented on GitHub (Mar 31, 2026):

I think this might be a broader issue. Put up what I think fixes here: https://github.com/cloudflare/vinext/pull/731

Root cause was that @vitejs/plugin-rsc rejects file-level "use server" exports when the exported value is a wrapped async action, for example:

"use server";
export const testAction = actionClient.action(async () => { ... });
<!-- gh-comment-id:4165852760 --> @southpolesteve commented on GitHub (Mar 31, 2026): I think this might be a broader issue. Put up what I think fixes here: https://github.com/cloudflare/vinext/pull/731 Root cause was that `@vitejs/plugin-rsc` rejects file-level `"use server"` exports when the exported value is a wrapped async action, for example: ```ts "use server"; export const testAction = actionClient.action(async () => { ... });
Author
Owner

@southpolesteve commented on GitHub (Mar 31, 2026):

@hi-ogawa any insight from the @vitejs/plugin-rsc perspective? I wonder if this is actually better fixed there

Background:

  • vite-plugin-react issue #618
  • That appears to have relaxed the wrap-export path.
  • But I’m still seeing a failure today with @vitejs/plugin-rsc 0.5.21 on what looks like the client proxy path.

Repro shape:

"use server";

export const testAction = actionClient.action(async () => {
  return { message: "Hello, world!" };
});
<!-- gh-comment-id:4166000292 --> @southpolesteve commented on GitHub (Mar 31, 2026): @hi-ogawa any insight from the `@vitejs/plugin-rsc` perspective? I wonder if this is actually better fixed there Background: - [vite-plugin-react issue #618](https://github.com/vitejs/vite-plugin-react/issues/618) - That appears to have relaxed the `wrap-export` path. - But I’m still seeing a failure today with `@vitejs/plugin-rsc` 0.5.21 on what looks like the client proxy path. Repro shape: ```ts "use server"; export const testAction = actionClient.action(async () => { return { message: "Hello, world!" }; });
Author
Owner

@hi-ogawa commented on GitHub (Mar 31, 2026):

That's what https://github.com/vitejs/vite-plugin-react/pull/754/ is intended to allow, so if not, it's likely a bug.

<!-- gh-comment-id:4166260555 --> @hi-ogawa commented on GitHub (Mar 31, 2026): That's what https://github.com/vitejs/vite-plugin-react/pull/754/ is intended to allow, so if not, it's likely a bug.
Author
Owner

@james-elicx commented on GitHub (Mar 31, 2026):

That's what vitejs/vite-plugin-react#754 is intended to allow, so if not, it's likely a bug.

I've just been looking through this, and it seems that differs from the proxy-export.ts file, so I've put up a PR to align them with the thought that it might fix the issue.

<!-- gh-comment-id:4166382062 --> @james-elicx commented on GitHub (Mar 31, 2026): > That's what [vitejs/vite-plugin-react#754](https://github.com/vitejs/vite-plugin-react/pull/754) is intended to allow, so if not, it's likely a bug. I've just been looking through this, and it seems that differs from the proxy-export.ts file, so I've put up a PR to align them with the thought that it might fix the issue.
Author
Owner

@james-elicx commented on GitHub (Apr 10, 2026):

The change in the RSC plugin was released as part of 0.5.22 - would you be able to try out the latest version and see if that helps with your issue?

<!-- gh-comment-id:4226631480 --> @james-elicx commented on GitHub (Apr 10, 2026): The change in the RSC plugin was released as part of 0.5.22 - would you be able to try out the latest version and see if that helps with your issue?
Author
Owner

@LubomirGeorgiev commented on GitHub (Apr 13, 2026):

@james-elicx Yes it seems to be working now.
What about https://github.com/cloudflare/vinext/pull/731? Does it need to be merged as well?

<!-- gh-comment-id:4234412179 --> @LubomirGeorgiev commented on GitHub (Apr 13, 2026): @james-elicx Yes it seems to be working now. What about https://github.com/cloudflare/vinext/pull/731? Does it need to be merged as well?
Author
Owner

@james-elicx commented on GitHub (Apr 13, 2026):

Thanks for checking - glad to hear all is working!

#731 doesn't need to be merged as it was a workaround for the behaviour in the RSC plugin, which has now been fixed upstream instead.

<!-- gh-comment-id:4234429254 --> @james-elicx commented on GitHub (Apr 13, 2026): Thanks for checking - glad to hear all is working! #731 doesn't need to be merged as it was a workaround for the behaviour in the RSC plugin, which has now been fixed upstream instead.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#154
No description provided.