Example code does not work

Hi community,

I'm having problems getting the nextjs-starter-prismic-blog to work.
The error is same as #52 issue.

Slice synchronization is finished and the document exists.

When I clicked on the eye icon to open the preview, displayed the following error.

Server Error
Error: An invalid API response was returned

Source
(api)/pages/api/preview.js (8:2) @ async handler

   6 |   setPreviewData({ req, res });
   7 | 
>  8 |   await redirectToPreviewURL({ req, res, client, linkResolver });
     |  ^
   9 | }
  10 | 

Do I need any other settings?

Sorry, I don't know why but it worked.
I unpublished the document and then published and it worked.
It appears that documents that have not gone through this process can now be previewed.
Perhaps it takes a while for the preview to become available?

The preview should be available right after you publish a doc. Sometimes this can be related to network issues.

Thank you for your reply.
The problem is currently not occurred, so I can't confirm if the network was related.
If the same problem occurs, I'll take a closer look at the network at that time.

1 Like