Why do my pages initially load a 404, even when Statically Rendered?

I’m relatively new to Builder and have created a number of Page Models which I’ve recently deployed. I found something that’s concerning me as it may impact SEO results and Lighthouse scores.

I’m using Next.js deployed on Vercel and when using the code snippets provided in the getting started sections, I’m finding that pages which should be statically generated are initially loading a 404 page, then showing the contents after a second or so.

Does Builder not provide the content to Next.js when the pages are being generated statically? Does it function more like SSR than SSG? If so, that’s a HUGE problem where we’re concerned, and frankly it seems really odd.

I tried adjusting my getStaticProps function to return notFound: true if page is null or undefined and when I did that, it never moved away from the 404 error which tells me something really strange is happening.

So, what’s the deal? Does Builder not provide the content until load, rather than at build time for Next?

Luckily, I think I figured out the answer to my own question. After comparing my code to some of the projects in Github, I realized I neglected to include options: { noTargeting: true } in the builder.getAll function call in getStaticPaths.

I was wondering why the list of pages coming back from Builder was empty, and that was why. So, if you run into this in the future, make sure you set the options correctly, and you can double check that it’s working by logging out what pages are returned, and if the array is empty, you’ll know what to check.

1 Like