I got an error when building
Answered
Harlex posted this in #help-forum
HarlexOP
Hello, I want to build my next tsx project and throw it to my plesk server, for this I made a few settings in the next.config.ts file, but I get a promise error in the slug of the blogs and I could not solve the problem, there is no API in my project, just pure design.
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "bebek.limonist.com",
pathname: "/images/**",
},
{
protocol: "https",
hostname: "bebekrestaurant.ae",
},
],
unoptimized: true,
},
assetPrefix: "http://bebek-restaurant.limonist.com",
output: "export",
trailingSlash: true,
};
export default nextConfig;
import BlogDetailPageContent from "./BlogDetailPageContent";
const BlogDetailPage = async ({
params,
}: {
params: Promise<{ slug: string }>;
}) => {
const { slug } = await params;
return <BlogDetailPageContent slug={slug} />;
};
export default BlogDetailPage;
PS D:\projeler\limonist\bebek-restaurant> npm run build
> bebek-restaurant@0.1.0 build
> next build
▲ Next.js 15.2.4
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
> Build error occurred
[Error: Page "/events/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.]
PS D:\projeler\limonist\bebek-restaurant>
Answered by Asian black bear
The build output literally summarizes what is wrong:
[Error: Page "/events/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.]
7 Replies
Asian black bear
The build output literally summarizes what is wrong:
[Error: Page "/events/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.]
Answer
@Asian black bear The build output literally summarizes what is wrong:
> [Error: Page "/events/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.]
HarlexOP
sorry it gave error for event but same problem for blogs
Asian black bear
It still tells you that you need a
generateStaticParams
function for your blog page.@Asian black bear It still tells you that you need a `generateStaticParams` function for your blog page.
HarlexOP
yes, but there is no API, should I do it with a json file?
Asian black bear
It depends how you store your content, that function must return a list of all valid slugs at build time. How you obtain it during build time is up to, depending on your data source.
@Asian black bear It depends how you store your content, that function must return a list of all valid slugs at build time. How you obtain it during build time is up to, depending on your data source.
HarlexOP
but I don't want to use generateStaticParams, is there a solution for this?
Asian black bear
If you want a full static export with
output: "export"
you have to use that function. That's how it works.