Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Issue with publishing new content in Sanity Studio + NextJs project.

116 replies
Last updated: Sep 9, 2022
Hi Team,
we are facing an issue that is blocking the production of our corporate website

it's a project involving Sanity Studio + NextJs

it has always worked perfectly

but suddenly we are not able to publish new content (at least from last week)

no errors or warnings are returned by the Studio

Here are the steps to reproduce the issue:

1 - updated a field in a document and published the change

https://files.slack.com/files-pri/T9Y440GN8-F041N6HTDLM/new-content.png 2 - schema is correctly updated

https://files.slack.com/files-pri/T9Y440GN8-F041R5NSVJ6/schema.png 3 - query (in Vision panel) returns an old version of the document without latest changes,
please notice the outdated '_updatedAt' value

https://files.slack.com/files-pri/T9Y440GN8-F041R5Q64H0/query-01.png
https://files.slack.com/files-pri/T9Y440GN8-F041N6LCJ2Z/query-02.png On the NextJs side

4 - query result is the same as in Vision (outdated)

https://files.slack.com/files-pri/T9Y440GN8-F041R5RCZ34/no-preview-mode.png
5 - new content is correctly displayed in Preview Mode only

https://files.slack.com/files-pri/T9Y440GN8-F042ES92Q8G/preview-mode.png
Can you please help us to figure out what's going on and a possible fix?
We have a bunch of resources blocked on this (devs, qa, editors) since days
and it's starting to have a very bad impact on the economic metrics of our company

Thanks!
Sep 9, 2022, 11:08 AM
Hello. Please kindly group your messages so we can use a single thread to discuss your situation.
Sep 9, 2022, 11:42 AM
Right now there are 8 different threads, which is pretty fragmented and confusing.
Sep 9, 2022, 11:42 AM
how can I group those?
Sep 9, 2022, 11:46 AM
Send a single message into the thread with all the information you have. :)
Sep 9, 2022, 11:50 AM
🙂
Sep 9, 2022, 11:51 AM
done
Sep 9, 2022, 11:52 AM
is it ok?
Sep 9, 2022, 11:52 AM
Amazing. ❤️
Sep 9, 2022, 11:52 AM
So much better, thank you!
Sep 9, 2022, 11:52 AM
What revalidation system do you have in place?
Sep 9, 2022, 1:05 PM
we use 'getServerSideProps'
Sep 9, 2022, 1:07 PM
no revalidation
Sep 9, 2022, 1:07 PM
I see. Do you set some caching headers perhaps?
Sep 9, 2022, 1:07 PM
nop
Sep 9, 2022, 1:08 PM
it has always worked fine before
Sep 9, 2022, 1:08 PM
suddenly this weird behavior
Sep 9, 2022, 1:08 PM
Do you use the Sanity CDN?
Sep 9, 2022, 1:08 PM
nop
Sep 9, 2022, 1:08 PM
could it be related to some quota limit?
Sep 9, 2022, 1:09 PM
attributes for example?
Sep 9, 2022, 1:09 PM
the documents are very complex in structure
Sep 9, 2022, 1:09 PM
Mmmh, maayyyyhaps? I'm not super sure I must say.
Sep 9, 2022, 1:09 PM
this is the dataset status
Sep 9, 2022, 1:10 PM
no limit warnings anyway ...
Sep 9, 2022, 1:11 PM
Do I understand it correctly: You are not able to see changes published in the studio when querying with Vision? Could you DM me your project ID?
Sep 9, 2022, 1:15 PM
8iokmtkl
Sep 9, 2022, 1:16 PM
correct
Sep 9, 2022, 1:16 PM
Could you double check if you’re editing the same dataset that your frontend is connected to? The examples in your screenshots seem to come from the
test
dataset, but I see you have one called
production
too.
Sep 9, 2022, 1:20 PM
already checked
Sep 9, 2022, 1:22 PM
unfortunatelly it happens with both datasets
Sep 9, 2022, 1:22 PM
I suspect it could be related to some content limit
Sep 9, 2022, 1:23 PM
attributes maybe
Sep 9, 2022, 1:24 PM
because documents are very complex in structure
Sep 9, 2022, 1:24 PM
a lot of fields
Sep 9, 2022, 1:24 PM
but it's just a guess of course
Sep 9, 2022, 1:24 PM
no errors or warnings returned
Sep 9, 2022, 1:24 PM
You’re close, but haven’t hit them. Curious, do you get any error message in the console, or network requests that aren’t 200 in the network pane when publishing?
Sep 9, 2022, 1:26 PM
let me check
Sep 9, 2022, 1:27 PM
these are returned before publishing
Sep 9, 2022, 1:29 PM
but nothing after pushing
Sep 9, 2022, 1:30 PM
Those seem unrelated – what about the network pane?
Sep 9, 2022, 1:30 PM
no 200 errors
Sep 9, 2022, 1:31 PM
only this is weird
Sep 9, 2022, 1:31 PM
Would it be OK if you invited me to your project for a bit? knut@sanity.io
Sep 9, 2022, 1:31 PM
sure
Sep 9, 2022, 1:32 PM
let me connect to a call
Sep 9, 2022, 1:32 PM
will be back to you asap
Sep 9, 2022, 1:32 PM
uhm I can invite you but the studio runs under a vpn
Sep 9, 2022, 1:35 PM
what if I share my screen
Sep 9, 2022, 1:35 PM
and you tell me what to do?
Sep 9, 2022, 1:36 PM
I only need access to try to reproduce the error before I escalate 🙂
Sep 9, 2022, 1:36 PM
don’t need the studio
Sep 9, 2022, 1:37 PM
do you need a specific role?
Sep 9, 2022, 1:37 PM
sent invitation for a viewer
Sep 9, 2022, 1:37 PM
I need write access, so developer would be handy
Sep 9, 2022, 1:39 PM
ok
Sep 9, 2022, 1:40 PM
done
Sep 9, 2022, 1:41 PM
Hm. I’m not able to reproduce it. I can write and update published documents on
test
at least.
Sep 9, 2022, 1:52 PM
So that narrows it down to your studio implementation probably
Sep 9, 2022, 1:53 PM
?
Sep 9, 2022, 1:54 PM
the schema is correctly published
Sep 9, 2022, 1:54 PM
but the query doesn't get the published content
Sep 9, 2022, 1:55 PM
all works fine in preview mode on the frontend
Sep 9, 2022, 1:55 PM
but not the query
Sep 9, 2022, 1:55 PM
what implementation part could determine the issue?
Sep 9, 2022, 1:56 PM
But preview mode fetches the draft version of the document, right?
Sep 9, 2022, 1:56 PM
And the production site only query the published documents, I’d think?
Sep 9, 2022, 1:56 PM
yes but it gets an outdated content
Sep 9, 2022, 1:57 PM
that is actually the issue 🙂
Sep 9, 2022, 1:57 PM
and one thing I don't get is why it stopped working suddenly
Sep 9, 2022, 1:57 PM
without breaking changes in the implementation logic
Sep 9, 2022, 1:58 PM
Hm. What would be an _id or title of a page that you expected to be updated, but isn’t?
Sep 9, 2022, 2:04 PM
homePage
Sep 9, 2022, 2:05 PM
_id
Sep 9, 2022, 2:06 PM
Aight - and I can only see one document in the production dataset that was last edited
"2022-09-08T10:25:41Z"
– can you actually see unpublished edits in the studio that’s newer than this?
Sep 9, 2022, 2:10 PM
"seoTitle": "2222224544444444SEO & METADATA",

Sep 9, 2022, 2:12 PM
are you referring to the test dataset?
Sep 9, 2022, 2:12 PM
ah sorry
Sep 9, 2022, 2:13 PM
just a sec
Sep 9, 2022, 2:13 PM
so
Sep 9, 2022, 2:16 PM
in the schema :
Sep 9, 2022, 2:16 PM
seoTitle:3453535Canary: A complete home security system in a single device. – Canary
Sep 9, 2022, 2:16 PM
_updatedAt:2022-09-08T16:05:43Z
Sep 9, 2022, 2:17 PM
in the vision query and frontend:
Sep 9, 2022, 2:17 PM
"_updatedAt":"2022-09-08T10:25:41Z"
Sep 9, 2022, 2:18 PM
old seoTitle
Sep 9, 2022, 2:18 PM
ah. I think I see it now
Sep 9, 2022, 2:19 PM
give me a hope please!!!! 🙂
Sep 9, 2022, 2:19 PM
Yes, the GROQ query gives a different document revision than the studio.
Sep 9, 2022, 2:20 PM
I’ll escalate this
Sep 9, 2022, 2:20 PM
?
Sep 9, 2022, 2:20 PM
I need to check with the Content Lake team. It seems like something is out of sync here.
Sep 9, 2022, 2:21 PM
so we wait for your feedback?
Sep 9, 2022, 2:21 PM
Yes, we’re looking into it now
Sep 9, 2022, 2:28 PM
thanks!
Sep 9, 2022, 2:31 PM
We have found the issues, and looking into solving it
Sep 9, 2022, 3:01 PM
cool!!!!
Sep 9, 2022, 3:02 PM
Side note: It’s probably not super productive feedback, but I’d look into generalizing the content models a bit more. It seems like you use
_type
for very specific pages and that you have a lot of attributes for presentational concerns (colors etc). These are patterns that drive a lot of attributes, but often can be moved to frontend design systems mapped to simpler values etc. If that makes any sense.
Sep 9, 2022, 3:03 PM
yeah I share your concern ....
Sep 9, 2022, 3:05 PM
Could you test if it works better now?
Sep 9, 2022, 3:13 PM
ure
Sep 9, 2022, 3:15 PM
yep it's working!
Sep 9, 2022, 3:16 PM
what was the issue about???
Sep 9, 2022, 3:17 PM
it seems not working for test dataset
Sep 9, 2022, 3:21 PM
production dataset seems fine
Sep 9, 2022, 3:21 PM
Try the
test
dataset again?
Sep 9, 2022, 3:28 PM
it's working!
Sep 9, 2022, 3:28 PM
Awesome. We’re looking into the core issue, but there was a sync issue. We triggered a manual sync to fix it. We’ll look into why it didn’t happen automatically.
Sep 9, 2022, 3:34 PM
so there's nothing we can do to avoid this kind of issues in the future right?
Sep 9, 2022, 3:35 PM
Correct, this is on our end
Sep 9, 2022, 3:36 PM
so ticket closed right?
Sep 9, 2022, 3:38 PM
or are you still checking?
Sep 9, 2022, 3:38 PM
ah noticed the checkmark now
Sep 9, 2022, 3:40 PM
thank you very much!
Sep 9, 2022, 3:40 PM
have a great weekend!
Sep 9, 2022, 3:40 PM
You too!
Sep 9, 2022, 3:49 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?