Server actions must be async functions
Answered
Bharat posted this in #help-forum
BharatOP
./app/actions.tsx
Error:
x Server actions must be async functions
,-[main-app/app/actions.tsx:4:1]
4 | import _regeneratorRuntime from "main-app/node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js";
5 | import { revalidatePath } from 'next/cache';
6 | import Papa from 'papaparse';
7 | export function create(_x) {
: ^^^^^^
8 | return _create.apply(this, arguments);
9 | }
I am getting above error in nextjs, any help?
Error:
x Server actions must be async functions
,-[main-app/app/actions.tsx:4:1]
4 | import _regeneratorRuntime from "main-app/node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js";
5 | import { revalidatePath } from 'next/cache';
6 | import Papa from 'papaparse';
7 | export function create(_x) {
: ^^^^^^
8 | return _create.apply(this, arguments);
9 | }
I am getting above error in nextjs, any help?
Answered by Bharat
Hey Joulev,
Thanks for your reply,
this is the server action signature: export async function create()
but
issue is resolved by removing the babel config
Thanks for your time!
Thanks for your reply,
this is the server action signature: export async function create()
but
issue is resolved by removing the babel config
Thanks for your time!
2 Replies
@Bharat ./app/actions.tsx
Error:
x Server actions must be async functions
,-[main-app/app/actions.tsx:4:1]
4 | import _regeneratorRuntime from "main-app/node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js";
5 | import { revalidatePath } from 'next/cache';
6 | import Papa from 'papaparse';
7 | export function create(_x) {
: ^^^^^^
8 | return _create.apply(this, arguments);
9 | }
I am getting above error in nextjs, any help?
make your server action async. how does your actions.tsx file look like?
@joulev make your server action async. how does your actions.tsx file look like?
BharatOP
Hey Joulev,
Thanks for your reply,
this is the server action signature: export async function create()
but
issue is resolved by removing the babel config
Thanks for your time!
Thanks for your reply,
this is the server action signature: export async function create()
but
issue is resolved by removing the babel config
Thanks for your time!
Answer