sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.32k stars 430 forks source link

[question] Why is the Embedded Studio not displaying published changes? #5066

Closed courtyenn closed 1 year ago

courtyenn commented 1 year ago

Sorry if this is the wrong repo. I figured I'd start here, but if I need to take this elsewhere I can.

Describe the bug

I am using sanity-template-astro-clean and when I publish changes in the embedded studio, hosted on Vercel, the published changes do not show up.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://www.sanity.io/templates/astro-sanity-clean
  2. Click on "Deploy with Vercel"
  3. Visit vercel link and go to "/admin"
  4. Publish content
  5. Visit vercel link
  6. See that the published content does not update. It seems to update when a new deploy happens, though

Expected behavior

Published content from embedded Sanity Studio should display automatically in the Vercel-hosted website

Screenshots Here is a video of me explaining the issue. The workaround is to deploy to Vercel, and that seems to revalidate the Sanity's cache? Maybe I need to open up a ticket with them?

https://www.loom.com/share/5cb32e2508cc42d3bcd8b127ca978678?sid=29497577-c2f8-4187-9beb-2fb60315e518

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

@sanity/cli (global)  3.17.0 (latest: 3.18.1)
@sanity/astro          1.3.0 (latest: 2.1.2)
@sanity/color-input    3.1.0 (up to date)
@sanity/image-url      1.0.2 (up to date)
@sanity/types         3.17.0 (latest: 3.18.1)
@sanity/vision        3.17.0 (latest: 3.18.1)
sanity                3.17.0 (latest: 3.18.1)

What operating system are you using? MacOS Ventura 13.4.1

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here.

Node: v20.7.0 NPM: 10.1.0

Additional context When I run my project on localhost, I can see published changes happen in real time and reflect in the frontend instantaneously. The problem where published studio content not showing up seems to be Vercel-specific, and is resolved whenever I re-deploy Vercel.

Seems to be related to issues:

I am not using Next.Js. I can try setting useCdn to true though

Security issue? No

courtyenn commented 1 year ago

Found the answer while looking at the integration of StoryBlok <> Astro: https://docs.astro.build/en/guides/cms/storyblok/#publishing-your-site

This is an Astro bug, not Sanity. Thanks

Solution: Use Vercel's "Deploy Hook" feature. Create a Webhook inside Sanity.IO and call the Vercel's Deploy Hook function.

github-actions[bot] commented 9 months ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.