Edge Server Actions

How can they be configured in server actions?
"use server";

import { revalidatePath } from "next/cache";
import { db } from "~/db";
import { presses } from "~/db/schema";

export const increment = async () => {
console.log("yo");
await db.insert(presses).values({});
revalidatePath("/");
};

export const config = {
runtime: "edge",
regions: ["iad1"],
};
"use server";

import { revalidatePath } from "next/cache";
import { db } from "~/db";
import { presses } from "~/db/schema";

export const increment = async () => {
console.log("yo");
await db.insert(presses).values({});
revalidatePath("/");
};

export const config = {
runtime: "edge",
regions: ["iad1"],
};
I tried this but I get the following error in vercel deployment...
Error:
x Only async functions are allowed to be exported in a "use server" file.
,-[/vercel/path0/src/app/action.ts:10:1]
10 | revalidatePath("/");
11 | };
12 |
13 | ,-> export const config = {
14 | | runtime: "edge",
15 | | regions: ["iad1"],
16 | `-> };
`----
Error:
x Only async functions are allowed to be exported in a "use server" file.
,-[/vercel/path0/src/app/action.ts:10:1]
10 | revalidatePath("/");
11 | };
12 |
13 | ,-> export const config = {
14 | | runtime: "edge",
15 | | regions: ["iad1"],
16 | `-> };
`----
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server