Next.js Discord

Discord Forum

Trying to use next-sanity is giving "missing exported function generateStaticParams()"

Unanswered
Hermit Warbler posted this in #help-forum
Open in Discord
Hermit WarblerOP
Im using output: "export"
Versions:
"next": "latest",
"next-sanity": "^8.5.0",
"sanity": "^3.36.0",


Page code:
// app/studio/[[...index]]/page.tsx

"use client";

import { NextStudio } from "next-sanity/studio";
import config from "@/sanity.config";

export default function Studio() {
  return <NextStudio config={config} />;
}


Gives this error: ⨯ Error: Page "/studio/[[...index]]/page" is missing exported function "generateStaticParams()", which is required with "output: export" config.

And when i make an empty "generateStaticParams()":
Error: Page "/studio/[[...index]]/page" cannot use both "use client" and export function "generateStaticParams()".

5 Replies

@Ray you can't build the sanity studio with static export. just use the one they host eg. your-project.sanity.studio instead
Hermit WarblerOP
Isn't static tho? i mean, you have to sanity deploy and it's kinda static, i thought it would work out the same way
seem like you have it
change the path to app/studio/page.tsx and <NextStudio history="hash" config={config} />