Next.js Preview Mode SSR Not Working As Expected

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 "@netlify/plugin-nextjs": "^3.0.3",

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.

Hi there, @andrew.nguyen :wave:

Welcome to the Netlify Forums :netliconfetti: Have you checked to see if there are any related issues open? GitHub - netlify/netlify-plugin-nextjs: A build plugin to integrate Next.js seamlessly with Netlify

I suggest taking a look! If you don’t see anything related, feel free to open one so that our Next.js experts can take a look. Should you open one, I encourage you to also include your site name and some screen shots of the behaviour you are experiencing :slight_smile: