Update preview url in settings then only homepage shows up

Hi,
I’ve updated a preview url in Settings>Preview from http://localhost:3000 to http://localhost:4000. Now the preview on localhost works only on draft pages. On published pages I always land on the homepage.

I’ve taken a look at this troubleshoot guide, but it did not help. When I copy-paste the preview token in the URL to test in the Rest API, I got “586 documents found” but I cannot see my preview.

The preview on Production works still fine on draft and published pages. I did not change the URL there.

So the code works for Production and the previous localhost but does not work for the new localhost.

What am I missing to make the new localhost preview URL work?

Hi Camille,

Thank you for contacting us, I will try to reproduce the issue on my side and get back to you.

Fares

Thanks Fares. Were you able to reproduce the issue?

Hi Camille,

I’ve tried to reproduce the issue on my local machine, and it seems to be working fine, I have modified the port by doing:
gatsby develop -p 4000
And in my Prismic configurations and I’ve added “http://localhost:4000”.

Can you try to open the preview in an incognito tab? Also are you sure that you didn’t change your link resolver implementation or the link resolver setting in your repo?

Hi Fares,
I see that could not reproduce the bug we are having :confused:.

I tried in incognito window and the issue is still there, still landing on the homepage for published pages only (still all good for draft pages).

No we did not make any change in the code itself while we were changing the localhost URL.

We also change the staging url at the same time. We have the same issue on both the new localhost and the new staging urls.
However, the previews on the old localhost and the production url are working fine.

So if you confirm that we only need to change the localhost port (or stagin URL) and to add the new preview URL in the Prismic configuration, then that’s what we did. So I’m wondering what is preventing the preview on published pages :thinking:

Hi Camille,

Can you try to clear your application cash? this can help sometimes?

Hi Fares,
I’ve cleared the cache of our application, but this did not help :confused:

Hi Fares,

I’m Anne, Camille’s colleague and working on the same project. I was wondering if there’s any news on this bug as it persists for us and we still couldn’t find out why it’s happening. We’d be happy about ideas! Thanks

Hi everyone,
the bug persists for us, if anyone knows a potential solution we’d be happy to discuss it! Thanks

Hi Anne,

This is a really strange one we haven’t seen before, can you try deleting your node modules and re-running npm install. Also at the same time run gatsby clean to see if that resets anything.

One question thought why did you change the port? Would switching back to http://localhost:3000 help?

Thanks.