I am working on a Next.js Project. I am trying to Build the Page with output: export
inside of the Config File.
My generateStaticParams uses this Code:
export async function generateStaticParams() {
const paths = await getActivePaths([PageTypeEnumeration.LANDING_PAGE, PageTypeEnumeration.PRODUCT_PAGE]);
return paths.map(path => {
const fullPath = process.env.PRODUCT + path;
return {slug: fullPath.split('/')};
});
}
export const dynamicParams = false;
This gives me the following Output, which is totally correct as i see it:
[
{
slug: [ 'product', 'lp', 'testpage' ]
},
{
slug: [ 'product', 'lp', 'testpage2' ]
}
]
I use a Catch all Route (app/[…slug]/page.tsx) and pass in the Params like this:
export default async function Home({params}: ParamsType) {
const {slug} = params;
Now in Dev Mode and running the Build without output: export
everything works fine. But if i use output: export
in the Config File it fails building the static Paths.
Heres the logged Output:
✓ Generating static pages (6/6)
Finalizing page optimization ..params { slug: [ '%5B...slug%5D' ] }
Finalizing page optimization ...(node:8101) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
params { slug: [ '%5B...slug%5D' ] }
Error occurred prerendering page "/[...slug]". Read more: https://nextjs.org/docs/messages/prerender-error
Export encountered errors on following paths:
/[...slug]/page: /[...slug]
Finalizing page optimization .%
I hope someone can help me with this, cause i don’t know what to do further.
Already tried to use export const dynamic = ‘force-static’; inside of Page.tsx as i saw it as possible Fix.
Simonxdev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.