You’re write in thinking that the new nuxt module handles previews out of the box. Also it seems the preview troubleshooting document is out of date in regards to this as the req is passed automatically now as you noticed, I’ll make a note to update this.
It sounds like you might be on the correct path with the link resolver.
Can you tell me if you added any other custom types to your repo than what came with the sample?
Also what is happening after you click the preview button, are you being directed to the correct page or the 404?
You will need to make sure you add all new custom types to the link resolver because the preview script uses this to parse the data. Can you tell me if this helps?
I have added all custom types that map to a page to my link resolver already. Should I add the others as well ? (ie: footer, menu) If so, I don’t really see how or why…
I found someone with a similar issue. Can you tell me if you tell me if in your repo’s preview settings (/settings/previews/) you have the following in your toolbar script link?
We pass ctx in the build as it allows us to access the req for the previews.
I saw that you based your project off of the multi page sample project that we created in Nuxt. I checked that sample and did a fresh deploy on Netlify and it generates the routes and the previews are working.
So this would suggest the issue here is in your project, specifically in the changes you made in changing the sample project. I spent a couple of hours looking at this yesterday and couldn’t figure where the issue is coming from.
So my suggestion is to start a fresh from the sample project and go step by step re-adding the changes that you made and deploying to see at what point either the routes stop being generated or the previews break. This way you can find what is causing the issue. My guess is that it’s all linked to the route generation.
I did as you suggested and went back in time checking where the preview stopped working. I went back all the way to the initial commit and the preview was still not working. And then I found the source of the issue.
It was a typo in the nuxt.config.js file.
The prismic endpoint was written with a capital letter in it.
I had endpoint: "https://360Learning.cdn.prismic.io/api/v2" and I needed to have endpoint: "https://360learning.cdn.prismic.io/api/v2"
I am really sorry to have wasted so much of your time on such a basic mistake.
Thank you so much for everything. Without your help, I think I would have turned crazy a few days ago.