Our team is building a Next.js commerce store with the ability to create pages through a backend CMS. However, we are running into some discrepancies with how Next.js works locally vs on Netlify.
We are on Next.js version
"next": "^10.0.3" and are using the Netlify Next.js plugin
Our app is backed with a CMS and has the ability to create pages, then navigate to the freshly created pages, and edit the content on those pages. Locally, this works fine. We click a button in Next.js preview mode to create a page, we can navigate to the new page, and the getStaticProps works fine in which we can do content edits on that page.
However, when deployed to Netlify, we go to our app, enter Next.js preview mode, create a page and then navigate to the new page, we get a 404 (presumably because getStaticProps and SSR) is not running correctly.
I have tried setting up
fallbackTo: true in getStaticPaths, but that still isn’t the correct behavior as it doesn’t fetch the page record from the CMS through getStaticProps, rather it just goes to a fallback page.