#Astro + Sanity + Netlify deployment issues

7 messages · Page 1 of 1 (latest)

patent oyster
#

I have a live site for a client with a content writer using Sanity to write blog posts at https://loumarcsigns.com/blog/. Now, she wrote a post yesterday and hit publish in Sanity. I can see the Webhook fired, and Netlify rebuilt the site.

I can see the blog page was built (Line 110) , and the new blog post (Line 112 see attached screenshot).

The new page shows up on the site if you manually enter the URL (https://loumarcsigns.com/loumarc-signs-unveils-new-bucket-truck-a-commitment-to-professionalism-sustainability-and/), however it doesn't show up on the blogroll page (https://loumarcsigns.com/blog/).

Here is the code for the blogroll page on GitHub (https://github.com/frankstallone/loumarc-astro/blob/main/astro/src/pages/blog.astro#L8). What am I doing wrong?

#

When I run the Astro site locally, I see the new blog post showing up in the blogroll page. 🤔 Really confused as to why it doesn't show up like this on the live site.

#

The workaround is that I have to manually make some change to the code locally, push that change, let Netlify rebuild and now the new post shows up on the live site's blogroll. This is undesirable. The Webhook build from Sanity to Netlify should be enough to do this properly. 🧐

lavish seal
# patent oyster I have a live site for a client with a content writer using Sanity to write blog...

I've not tried Sanity yet, but looking at your setup I couldn't see anything wrong with your API usage. However looking at similar problems others have had with Sanity, I believe the problem might be related to enabling the useCdn config option in your Astro config.
https://github.com/frankstallone/loumarc-astro/blob/main/astro/astro.config.mjs#L13

According to Sanity's documentation:

Sanity provides two APIs:

  1. api.sanity.io: the live, uncached API. This is the default and will always give you the freshest data, but requests will be slower because they need to reach our back end on every request. Requests are also more costly because they will trigger more computation on our servers.
  2. apicdn.sanity.io: the CDN-distributed, cached API, which is an opt-in feature that will give you very fast responses to requests that have been cached. We encourage most users to use this API for their front-ends if you expose your API to end users. For static builds you are better off using the live uncached API, to always get the latest version.

So, setting useCdn to false should fix this. Let me know how it goes!

empty musk
#

Hi @patent oyster
I am expereienced in Sanity and Astro.js. Could you help me so that I can check your code base please? I guess that is not critical issue. I can solve that issue. If that issue still exist, please contact me

narrow bramble
#

@patent oyster Did you use "draft" when composing the page?

patent oyster