Slice Simulator on Netlify

I'm trying to setup the new live preview feature as per Live Editing - Documentation - Prismic

It says "

Your project must be deployed. Once deployed, you can check to ensure that the slice simulator is working by visiting your-site.com/slice-simulator

However, when I view that page I get an internal server error.

Looking at Netlify's logs I see this. When I try the file locally it works though.

Any ideas?

Hi @tim5,

Have you set up the slice-simulator page in your project? It seems like it might be treating it as a normal Prismic page and expecting to retrieve content via your /page/[...uid] route.

I recommend checking out one of our starter projects to see what this route should look like:
https://github.com/prismicio-community/nextjs-starter-prismic-blog/blob/4c022b59ac36547afb887ab25a0c409de83ce10d/src/app/slice-simulator/page.js

That project uses the app router and it seems that you're using the pages router, but the slice-simulator page should be the same in either case.

Let me know if this works for you or if you have any other questions.

Cheers,
Levi

Got the previews working. Issue was that the site was behind a password on Netlify.

Glad to hear you got it working, @tim5! Thanks for posting your solution :fire: :100:

Hi @samlittlefair I'm running into this issue where the netlify hosted website is behind password protection while the client enters content before launch (some clients are like this and want passwords while the website is being worked on.).

This obviously means that the prismic backend cannot reach slicemachine, so the slice previews show 'error'

Is there anyway around this? Maybe a password config for slicemachine to be able to reach netlify?

Hi @grafik, unfortunately there's no way around this. If the project is behind a password, you'll get an error on the Netlify previews.