Error: Page "/api/my-trip/[hash]" is missing "generateStaticParams()" so it cannot be used with "out
Unanswered
Cuckoo wasp posted this in #help-forum
Cuckoo waspOP
This is the full error text :: Error: Page "/api/my-trip/[hash]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
Hi can anyone help to resolve this.
This is my route.ts file to the following path:
Hi can anyone help to resolve this.
This is my route.ts file to the following path:
"generateStaticParams()";
import { resultParams } from "@/types/server";
import { NextResponse } from "next/server";
export async function GET(
request: Request,
{ params }: { params: resultParams }
) {
const URL = process.env.FLIGHT_SEARCH_URL as string;
const hash = params.hash;
const res = await fetch(URL, {
method: "POST",
mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
body: atob(hash),
});
const data = await res.json();
return NextResponse.json(data);
}4 Replies
generateStaticParams is a function that exports the list of params to be created as routes
as you are doing static, the server can't do the fetch dynamicly
and you don't use it like a string a the top