Next.js Discord

Discord Forum

Trying to disable caching for specific server action but getting error

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
Error: 
  × Only async functions are allowed to be exported in a "use server" file.
    ╭─[/home/seif/lego-ai/src/app/lib/generateLegoSet.ts:5:1]
  5 │ import { kv } from "@vercel/kv";
  6 │ import { UTApi } from "uploadthing/server";
  7 │ 
  8 │ export const dynamic = "force-dynamic";
    · ───────────────────────────────────────
  9 │ 
 10 │ const utapi = new UTApi();
    ╰────

how else am I supposed to disable cache if this is a server action?
Answered by Transvaal lion
Got it to work by using noStore();
View full answer

2 Replies

Transvaal lionOP
Got it to work by using noStore();
Answer
Transvaal lionOP
Idk why this stuff is so confusing man lol