NextJS Preview mode only works locally

Hi!

I’m currently building a preview mode for our editors. The preview has been setup in accordance with the NextJS Preview mode docs and DatoCMS docs. Everything works completely fine locally, however, when a deploy to Netlify is made It creates a client side exception error (500) - once cookies are set.

Deploy preview: https://6290891fc366da7a5fc6093c--yoto-uk.netlify.app
Setting preview cookies: https://6290891fc366da7a5fc6093c--yoto-uk.netlify.app/api/preview?secret=test_string&slug=yoto-mini

Note:
@netlify/plugin-nextjs - v4.2.1 - any higher upgrade to this plugin also causes the entire site to client side exception error

Seems similar to this issue: NextJS preview works locally but not on Netlify

Any help would greatly be appreciated!

Hi @Y-Ollie,

The previous issue is very old and the version of the plugin being used then is now unsupported. So we can keep that aside for now.

Do you have any deploys in which you used the latest version of the plugin? We can escalate this to the engineers, but if they see an older version of the plugin, they’d first flag that.

Hi @hrishikesh!

Thanks for reaching out.

Here is a preview deploy with the most recent version of the plugin: https://62949e8918aa31103a379a5e--yoto-uk.netlify.app/

https://app.netlify.com/sites/yoto-uk/deploys/62949e8918aa31103a379a5e

Thanks!

Just a quick update, we’ve updated the bug here: [Bug]: Error during deploy: "Error: ENOENT: no such file or directory, copyfile" · Issue #1366 · netlify/netlify-plugin-nextjs · GitHub

Thanks for the update!

Hi Hillary, Has there been any update on this? We are currently unable to move forward on a lot of our projects.

Sorry for the delay in response! Our developers just gave you some feedback in the GitHub issue yesterday, and will likely respond there going forward.

Please give that advice a try and let us know how it goes!

Hey! We tried different versions of the plugin but still no luck :confused:

Any further advice from the developers?

Thanks!

No, because we haven’t yet seen the results of your experiments.

Please link us to deploy logs where you try the latest version of the plugin, and we’ll be happy to look further. Suggest linking them here rather than just in the github issue since our Support team is not “Tracking” the github issue but we are tracking this thread :slight_smile: