Shareable link for prismic preview not working

Hi Community,

We have been facing an issue with the Prismic preview functionality. The Preview is working fine but when we generate the shareable link from the Prismic toolbar and open the same in a different browser then the preview doesn’t work over there.

We have also obersved that the url that is generated for prismic preview has a difference from the url that is generated via the shareable preview. The normal preview has this string in url 's5Su&documentId' where as the shareable link has this string 's5Su&amp%3BdocumentId', whereas the rest of the url is same in both the cases.

Kind regards,
Parth

Hi Parth,

Thanks for reaching out; I will try to troubleshoot this issue with you.

I don't know if the difference in the URL causes this because both are almost the same as & equals & in HTML, so I don't know for what reason we have this HTML character in the URL.

In order to produce this issue on my side, it would be great if you can share with me (in a private message) your repository name.

Also, it would be beneficial if you can give me temporary access to me to your repository to test the sharable links.

Looking forward to your reply,
Fares

Hi,
I've currently investigating this issue,
In fact, I've noticed that when using sharable links and open in a private window, the preview cookie is missing.

I will investigate this issue more and get back to you once I find the reason for this behavior.

It is still not clear for me of what is the root of the issue, to debug further can you share with me a code snippet of the code responsible of the preview or better give me access to your source code (in a private message)

Hello,

We have provided you temporary access to our repository. Please let me know if you have got the invite for the same.

Hi,

Yes, we have access and I've done some tests, In fact, I have tested on another test repo and the sharable links are not working.

So for that, I have created an issue in our tracker to have someone from our dev team work on this issue and we will let know in case of any updates.

Note that we haven't got other reports about issues with sharable links in Nuxt.js but we are still investigating.

1 Like

Hi,
I've got some updates from our dev team, and they wheren't able to reproduce the issue, Infact I also tested with one of our samples and the sharable links work.

And here is a summary of the our tests:
Chrome:

  • Guest session: work as expected;
  • Incognito session: doesn't work, this is expected during incognito/private sessions because of stricter cookie policy.

Firefox:

  • Random session (not logged in to Prismic): work as expected.

So for us most likely this issue is on your side and yes I have been able to reproduce the issue on your side

To dig deeper into this issue we would need:

- `package.json` details (at least all (dev)dependencies);
- `nuxt.config.js` details (ideally all of it);
- A peek at one of your pages under the `~/pages` directory (at least the `asyncData` call);
- Some information about your deployment environment;
  (static like Netlify or dynamic with Nuxt universal & a server behind it)
- Browser used & versions;
- Anything you might think of that might tamper the cookies.

Hi Fares,

Thanks for your response!

Please find below the information that is requested by you on our project :-

  • package.json details -- Have provided you access to the repository

  • nuxt.config.js details -- will be available on the repository

  • A peek at one of your pages under the ~/pages -- This also will be visible on the repository

  • Information about your deployment environment -- Dynamic with Nuxt universal & AWS EC2 Servers behind it

  • Browser used & versions -- Chrome Version 93.0.4577.82 (Official Build) (64-bit)

  • Anything you might think of that might tamper the cookies -- No we dont think there is anything that can tamper the cookies

Please let us know if you face any difficulty in accessing the repository.

Thanks,
Parth

1 Like

Our developers have debugged the issue that you are facing and in fact, it seems that sharable links never worked for you and basically you aren't using the Nuxt Module we offer because I think you have started to work on your website before we have introduced it.

Due to that, you are doing Prismic Nuxt previews the "old way".

On this layout ~/layouts/default.vue , line 186-202, You are conditionally loading the toolbar based on the presence of our preview cookie.

While this works for regular preview sessions this doesn't work for shared preview sessions.

Indeed when on a shared preview session it's the toolbar itself that is responsible for creating our preview cookie. And so you fall under this loop for shared previews:

no cookie -> no toolbar -> no cookie -> ...

The easy (and official) fix would be to load the toolbar every time (our toolbar script has shrunk by a lot since last year, the script is now down to 14kb compared to 100kb+ before)

Another solution we recommend that is more future-proof is to migrate to the Nuxt new preview module that is very easy to use and is way simpler,

Please let us know if you have any further inquires,
Fares

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.