Nextjs getStaticPaths Error: getStaticPaths is required for dynamic SSG pages . NextJS

545 Views Asked by At

I have been trying to use getStatic props in my nextjs project, to pre-render the component for seo purpose. getStaticProps was used inside the pages and when i try to build the project it shows the following error.

"getStaticPaths is required for dynamic SSG pages and is missing for "xxx". NextJS"

I tried to use getStaticProps inside the pages and to load the data for seo purpose and i want to build the project, get the data via api call in the pages.

1

There are 1 best solutions below

1
rvk46 On

For dynamic pages or slugs, the path with expected params has to be defined in getStaticPaths. Please refer https://nextjs.org/docs/basic-features/data-fetching/get-static-paths