Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prismic toolbar can't access previewSession cookie ("lax") on latest chrome release #63

Open
tcharlat opened this issue Apr 15, 2020 · 7 comments

Comments

@tcharlat
Copy link

Related issue prismicio/prismic-client#128

I had a setup properly configured and working 3 weeks ago:

The endpoint was correctly set, the prismic toolbar was loaded via https://static.cdn.prismic.io/prismic.min.js

Then, around 3 to 2 weeks ago, the preview feature stopped functioning.

  • there is no toolbar anymore
  • the preview cookie is not sent to the server side renderer anymore

Both of these features were working correctly until recently.

When inspecting the page, I have a valid preview cookie

  • domain: the correct endpoint of the backoffice
  • name: io.prismic.previewSession

But the sdk is seemingly not detecting it's on a preview page and is not triggering the splash screen and toolbar as it was 3 weeks ago.

I can't test to roll back to a previous version of my site, even by checkout on a guaranteed functional commit, since the prismic sdk https://static.cdn.prismic.io/prismic.min.js is some kind of a "latest" version only.

I tried to find some documentation on a semver for the cdn, something like https://static.cdn.prismic.io/prismic.min.js?version=2.1 , but did not find any information indicating something like this is in place.

Can you help me investigate this regression ?

@tcharlat
Copy link
Author

I dove in the chrome debugger, the issue is that the iframe can't get the document cookies:

iframe_debugger

It's hard to say if it's a bug or a false negative that stayed silent too long, some people debate this here:

https://support.google.com/chrome/thread/33543699?hl=en

Once I saw this I checked with Edge and the preview works as intended, reads the io.prismic.previewSession cookie.

I think there may be some settings to update when setting the cookie to allow it to be extracted from iframe, here some more insight.

https://blog.heroku.com/chrome-changes-samesite-cookie

It's highly probable that all browsers may embark on this security train and that the preview will gradually stop working on more and more environment until fixed.

I would advise to consider this very seriously :)

Good luck

@tcharlat tcharlat changed the title The toolbar stopped appearing on preview Prismic toolbar can't access previewSession cookie ("lax") on latest chrome release Apr 16, 2020
@srenault
Copy link
Contributor

srenault commented Apr 16, 2020

Hello,

It's kind of weird since we have updated the backend to set the SameSite attribute to "None".
I just tested and it seems to work well on my side:
Screenshot 2020-04-16 at 16 19 21.

Could you paste here a screenshot of your cookie panel? If you prefer, we can communicate through our support chat (Intercom).

@tcharlat
Copy link
Author

@srenault perfect !
I guess my client has a custom enterprise instance of prismic on premise and is lagging behind on updates.

Could you give me some kind of version identifier where the SameSite attribute has been updated, so that I can open an internal request to update it on our side ?

Thanks for the support, safe to close.

@srenault
Copy link
Contributor

srenault commented Apr 16, 2020

The thing is we don't sell custom enterprise instance. Could you give me the repository name of your client so I can check on which version your client is on?

@tcharlat
Copy link
Author

I emailed you on your public github email.

@vbejgrowicz
Copy link

Hi,

My team is also experiencing this same issue when trying to preview on the latest chrome release. It looks like the io.prismic.previewSession cookie is being set without SameSite: "None" which is causing the iframe to be unable to get the cookies. Also it looks like it is mistakenly setting a cookie with the key=SameSite and value=None.

See screenshot of my cookie panel:
Screen Shot 2020-11-05 at 4 27 03 PM

Let me know if you need anything else!
Thank you!

@w3rafu
Copy link

w3rafu commented Nov 17, 2024

I am having 99+ console error because Cookie “io.prismic.previewSession” has been rejected for invalid domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants