Good day Prismic/Gatsby people.
I'm hosting on Gatsby Cloud and made the migration to v5 Prismic Tools.
It was a mostly painless migration. The raw/richText was the hardest part.
Access to fetch at 'https://{reponameRemoved}.cdn.prismic.io/api/v2' from origin 'https://preview-{gatsbyCloudNameRemoved}.gtsb.io' has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.
Am I missing something? Is there a known issue? It's probably just me, right?
Just today, we've updated those documents to support the latest versions of the plugins, glad to see you already found them!
The error doesn't seem like something coming from Prismic. CORS issues happen for various reasons. Usually, they appear when an app checks if the server you're using can be accessed from the browser. I've seen cases where the warning disappears when people update their URLs to use https instead of HTTP.
In which step of the migration are you? Have you been able to run your project in development?
We're also experiencing this issue after upgrading to Gatsby 4 and the v5 prismic tools. We're using https and URL's haven't changed. We're hosting on Gatsby Cloud also - though the preview plugin didn't have a CORs issue prior to the upgrade.
Thank you to @Pau & @paul3 for the quick and successful resolution of this issue. I have applied the 5.0.2 updates and can report that the CORS issue has been resolved.
Now this may be an entirely separate issue, but since I've found a couple of helpful people, I'm going to press my luck and ask. The unpublished previews, if I follow the docs for the v5 tools and stop where it says to stop if you use Gatsby Cloud, will they work? Or do I need to go through all of the other steps if I want unpublished previews?
I'm yet to have been able to get unpublished previews to work - I've only been able to get them running when the content is published. I think historically you used to be able to publish, then unpublish and it would work (I could be wrong here) - but we're currently unable to do that either.
Hey there @edtech and @paul3. We've tested a deployment and preview setup with Gatsby Cloud and noticed two things that are necessary (they're now part of the Prismic + Gatsby Cloud doc).
The Link Resolver of the preview config in the repository must have a trailing slash (for example, /preview/, not /preview) to ensure they send the URL parameters to the preview page.
Let us know if you can configure the previews successfully!
How would this work if we're not actively using releases?
My (limited) understanding of releases is that they'd change frequently as the content team do their work. As a result, the release ID would have to be continuously updated and the content team don't actively have access to reconfigure the environment variables each time within Gatsby cloud (for security reasons).
Is there a value that we can provide that targets the 'master/mainline' release or is there a workaround / particular workflow for this?
What changes is the release ref. The release ID is a unique identification per release. You can see the difference in your repository’s API browser. Look at this example:
Thank you for continuing to support our request for support with these previews. I have followed the steps to the best of my ability. I have a Gatsby Cloud Previews release to which I publish content I want to preview prior to publishing. This seems to work!
Thank you. I will continue to report here for updates and to provide updates as I experience changes. @paul3, let me know if you need any help.
Thank you very much for the outlook, @edtech!
Threads in the forum close after seven days of inactivity. If this happens before you post any updates, please feel free to reopen it by clicking the flag button. Then you can add a new comment.
Apologies for the delay in getting back to you - we were able to get this to work by creating a release.
The gatsby-cloud specific doc was particularly helpful - thank you.