birkir / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
137 stars 75 forks source link

Can't get previews working #219

Open miraclemaker opened 4 years ago

miraclemaker commented 4 years ago

I've set up preview url in Prismic. Used the same path for 'link resolver' as the preview path in my gatsby-config.js

When I try and preview it opens up the site ok, then I can see a 401 request to https://xxxxx.cdn.prismic.io/api/v2 with the response:

{"error":"Invalid access token","oauth_initiate":"https://xxxx.cdn.prismic.io/auth","oauth_token":"https://xxxx.cdn.prismic.io/auth/token"}

The page itself is blank with a purple box bottom left. The purple box has the correct (updated) title of the page being previewed.

fitzgers commented 4 years ago

I have been having the same problem for some time now. I was finally able to get it to work on localhost by changing the Prismic API settings to Open, but still no luck on the hosted version of the site.

miraclemaker commented 4 years ago

Thanks for the response. I tried changing my API settings to open from private. I can see the request to https://xxxxx.cdn.prismic.io/api/v2 is getting a response now, but the page is still blank. There's no output in the console to give an indication of what is going wrong.

miraclemaker commented 4 years ago

If I take the preview URL and alter it for localhost it does load the page, but it's the original version not the updated version I wanted to preview. It still has the purple box at the bottom left.

fitzgers commented 4 years ago

@birkir @riywo @veloce and team , any chance we can get some feedback or help on this one? I've chatted with Phil at Prismic extensively on this, and his last response to me was this:

The team had a look and the thing is that the query when doing a preview and calling the API is not passing the token. We don't know why. This looks like an issue in the plugin, so we'd recommend creating the issue directly in the plugin at the moment

Any attention and/or feedback you can provide on this one would be much appreciated!

ohlr commented 4 years ago

Duplicate of https://github.com/birkir/gatsby-source-prismic-graphql/issues/45