Prismic preview working in localhost but not on staging/production environments (Nuxt/Netlify)

Hi all,

I was hoping someone could help me with an issue I'm having getting Prismic Previews to work. I've scoured this forum for a solution but unfortunately I wasn't able to find any that worked for me.

I am developing on Nuxt/Netlify for a client and am trying to set up Prismic Previews for them. I've left the Link resolver to "/preview" and I've installed the @nuxtjs/prismic package into my repository.

I have 2 Prismic repositories, one for development and the other is for the client. Both configurations are the same, bar the content (we still use the same content types). On our development repository, previewing content works fine; I am able to see the content I have not yet published to the document. However, on the client repository, with the same setup, whenever I click on the Preview button, page will load fine except the content does not show any of the changes I've made.

Could someone help me out? Happy to provide more information if required.

Hello @sog, if you're using environments, you must remember that these work as separated entities. Even if they share the same Custom Types and content, they are two different entities. If you have configured your project to set up previews only for the first one, you need to test with the second repository URL and add a new Link resolver for it, for example: /preview-staging

Hello @Pau thank you for your reply.

I am not using Prismic Environments, I am using the same code repository for both Prismic repositories. When I set up the Previews on both, I make sure that the link resolver is the same. In fact, on my staging site, I can get the toolbar to appear and I can check the cookie which when I query it, will return the updated document, however, on the front end, the content does not appear updated.

I understand. Maybe there's something missing in your preview configuration. We have a list of troubleshooting steps that you can check out here:

Also, you can share your project setup with us to see if there's something missing. For example, in next, you now need to wrap your application with a PrismicPreview component:

Hi @Pau,

Is it ok if I zip up my project and send it to you? I have been having no luck with this at all.

Thanks

Could you send us the code for your _app.js and prismicio.js files?

Thanks for sending over the additional info.

We'd like to know how you are querying your Prismic API with Nuxt & PHP and how you provide that data to the frontend.
If you query Prismic from the backend, this can cause issues with Previews if the cookie is only created on the frontend, not forwarded to the backend, or the other way around.