Could I get some assistance as I'm driving myself crazy with this one.
When I click on the 'Preview' icon in Prismic I am taken to the server and I see various url params, but just get an "Internal Server Error" 500 response.
I've followed the docs, as well as the troubleshooting guide, but am still very much stuck. Hoping my use case might help others who end up in a similar corner (whatever corner that may be ;-) )
So, first off I've created the pages/api/preview js file and ensured that it is importing the correct environment values in Client for the req. I've also checked that the linkResolver looks in order. Seems simple enough.
I've checked the browser has got cookies set (I see x2 cookies).
I've also set the preview site address in the Prismic settings UI to match up with my local dev environment (http://localhost:3000) - I've tried my public address too - both exhibit the same error behaviour.
Which leaves me to think that the issue lies in my getStaticProps in my dynamic [uid].js page - does this look ok?
I'm guessing you had some cookies that didn't get cleared and are not out of date. If you clear these and start again it should work. The cookies you'll want to clear are:
io.prismic.preview
_next_preview_data
_prerender_bypass
Then to make sure this doesn't happen again in the future, make sure you add a exit preview button to clear the next.js cookie.
When developing locally I was holding the prismic token etc within the .env file, which for security reasons is not synced to my git repo. When Vercel performs its build it gets the code from the repo so doesn't have the environment variables. Hence the Error 500.
The fix was to go to Vercel and go to Project -> Settings -> Environment Variables and set them there.
Hey, so I am facing a similar issue. I use next.js on my application and I am receiving 500 Internal Server Errors on my unpublished documents. It works fine for all other documents.
@andreas.kratzel If @andrzej's suggestion doesn't work, you could send me a ZIP file or git repo containing your project, and I could try to find the source of the problem. Feel free to send it in a DM.
Best,
Sam
samlittlefair
(Sam Littlefair)
closed , flag & select 'Something Else' to reopen.
16
This thread has been closed due to inactivity. Flag to reopen.