question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview not working in SSR

See original GitHub issue

Hi,

In nuxt ssr true this doesn’t work for my project

Here is my prismic code

prismic: {
    endpoint: 'https://my-repo.cdn.prismic.io/api/v2',
    linkResolver: '@/plugins/link-resolver',
    htmlSerializer: '@/plugins/html-serializer',
    preview: '/preview'
    /* see configuration for more */
  },

Error in console

Access to XMLHttpRequest at 'https://my-repo.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=1&ref=https%3A%2F%2Fmy-repo.prismic.io%2Fpreviews%2FYAGwfBEAACMAgZ45%3AYAGzWREAACAAgaup%3FwebsitePreviewId&lang=*&q=%5B%5Bat(document.id%2C%20%22X_2fHxEAACEAbu1Q%22)%5D%5D' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
lihbrcommented, Jan 22, 2021

Hey, I was able to reproduce the issue with @phillysnow, finally!

After analyzing working and not-working lock files, turns out the issue was a really murky one due to @nuxt/ufo@0.5.0 that was introduced in nuxt@2.14.12 patch on the 16th of December.

Everyone that installed this patch before the 6th of January might encounter it.

After this date, the bug got fixed as of @nuxt/ufo@0.5.3 release.

If you’re encountering this bug, to fix the issue you need to run $ npm update or $ yarn upgrade in order to update @nuxt/ufo to version 0.5.3 or higher, let us know if the bug persists.

Cheers~!

1reaction
lihbrcommented, Jan 19, 2021

Here’s a quick follow up of our discussion on Twitter:

After some time we noticed that that the value of websitePreviewId was getting stripped on Rahul’s website, leading to the issue: image

We tried to troubleshoot a ton of things to figure that out. Unfortunately, I wasn’t able to reproduce this issue on my end and Rahul was not able to attempt a reproduction. Being fine with not having preview for now we’re closing this issue.

Happy to reopen it if someone is experiencing the same issue or able to provide a reproduction!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preview not working in SSR · Issue #115 · nuxt-modules/prismic
Hi, In nuxt ssr true this doesn't work for my project Here is my prismic code prismic: { endpoint: 'https://my-repo.cdn.prismic.io/api/v2', ...
Read more >
Does Live Preview with SSR still function? | Community
I do have Live Preview working using the example NextJS repo, but this is based on client-side rendering. Should SSR still work and...
Read more >
React Server Side Rendering (SSR) meta tags og not ...
I need a solution for all the dynamic links to display preview info with ... Problem is that I need a subscription plan...
Read more >
Sanity.io SSR previews without changing your front-end code
This works okay, but requires you to change your components and front-end code. Previews should be table-stakes for editorial experience, but ...
Read more >
Advanced Features: Preview Mode | Next.js
js has a feature called Preview Mode which solves this problem. Here are instructions on how to use it. Step 1. Create and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found