Hi all, we've recently bumped our Next.JS package to 12.2, and we have some Next.JS middleware used for A/B testing in place on the site. When testing locally in development mode, preview links work fine when used from the dashboard. When using the production build however, the links flicker to the content to preview, and then 404 a second later.
Removing the middleware seems to resolve this issue, although even having the middleware return NextResponse.next() still seems to throw the same error. Cookies seem to be empty on the outgoing response, so this may be partially the issue however cloning request cookies to the response doesn't seem to help either.
Welcome to the Prismic community.
We apologize for the delay; this thread wasn't tracked correctly.
I have found this thread that describes what seems to be the same issue.
So If the preview is working entirely on your local host, then the problem must be a configuration of the deployment service you are using.
Can you please list the npm dependencies you use in your local project to ensure that everything is up-to-date? (I personally doubt that the problem is from your code).
Also, can you add some screen recording/screenshots of the error and, if possible, the deployment platform you are using?
You can also check this thread that might help
Looking forward to your reply,