-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Getting TypeError: Invalid URL on redirectToPreviewURL on the Next.js preview api route.
Versions
@prismicio/next: ^1.5.0next: 13.1.6- node: 16.14.2
Reproduction
Just following the simplest Next.js documentation to enable previews:
On api/preview.ts:
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const client = Client({ req });
setPreviewData({ req, res });
await redirectToPreviewURL({
req,
res,
client,
linkResolver: previewLinkResolver,
});
}
Steps to reproduce
yarn dev then access any preview link. e.g. /api/preview?token=:token1&documentId=:id
What is expected?
redirectToPreviewURL shouldn't error. Afaik latest prismic-next version works fine with Next.js 13
What is actually happening?
Editing the document on Prismic and then clicking the "View" redirects just fine to my local preview route, but redirectToPreviewURL errors with 500 and unable to view anything.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
