Preview not working

My preview functionality was working earlier now it’s not working,

And I see some deprecation warnings in console ( ref to screenshot)
although i have copied the script from Settings > Previews > Script

I have tried changing the script to the suggested one in console. On changing the script my preview still isn’t working and i see a parse error:

Error: Parse Error: <script async defer src=//static.cdn.prismic.io/prismic.js ?repo=example-repo&new=true></script>

Can someone help me with this

Hi @Ujjwal,

Welcome to the community!

I see that there a space between prismic.js and ?repo in the script:
<script async defer src=//static.cdn.prismic.io/prismic.js ?repo=example-repo&new=true></script>

Is this just a copy and paste error?

Hi @Phil,

No , there is no space in actual code. This error was copied from console output maybe that’s why there is an extra space.

Also i was wondering is New toolbar activated for my account ? ( maybe not toolbar is not activated that’s why i still see old script in Settings > Previews > Script )

That’s correct, if you still see the old script without new=true like so…

<script>
  window.prismic = {
    endpoint: 'https://php-multi-test.cdn.prismic.io/api/v2'
  };
</script>
<script type="text/javascript" src="https://static.cdn.prismic.io/prismic.min.js"></script>

Then this is the recommended script for you repo.

<script>
  window.prismic = {
endpoint: 'https://my-repo.cdn.prismic.io/api/v2'
  };
</script>
<script type="text/javascript" src="https://static.cdn.prismic.io/prismic.min.js?new=true"></script>

i see this script in my account’s Settings > Previews > Script. is this correct ?

and what about console warning suggesting to use

<script async defer src=//static.cdn.prismic.io/prismic.js?repo=example-repository&new=true></script>

which one is correct ?

The correct one is the one suggested in your repo settings.

We are in the process of updating our documentation to make this clearer and I’m going to contact the dev team to make that console warning that you’re seeing clearer.

Ok i’ll wait for the documentation and the clearer console warning meanwhile I’m using script from setting of my repo ( although i still see deprecation warning) .

Can you help me understand why has my preview functionality stopped i have tried debugging everything is same ( from the time it was working).

Have gone through the troubleshooting page as well https://user-guides.prismic.io/en/articles/3403530-troubleshooting-previews

Everything seems fine, i tested the rest API as suggested in troubleshooting page

got this response

{
"label": "Live now",
"ref": "X1nbERAAAB_RYrpo",
"mainDocument": null,
"type": "LIVE"
}

is this correct ?

What could be the issue with preview cause it is redirecting me to correct page and rendering the blank page there.

I can’t say off the top of my head.

Can you try doing the preview in a different browser?

If you see no change can you send me a private message with a zip of your project and the url of your repo so I can test on my side?

Thanks.