Unlock seamless workflows and faster delivery with our latest releases – get the details

Upgrading Sanity and encountering an issue with the .apiversion in the schema.

8 replies
Last updated: Apr 24, 2024
Hey y’all! Just upgraded sanity and now I am seeing this in my structure. Not sure where I need to address this. Any thoughts?
Apr 24, 2024, 5:33 PM
user M

in the console errors or warnings it should say that
.apiversion
is required in your schema now. so I have

.apiVersion('v2024-04-01')

on all document schema views like


s.listItem()
.title(itemTitle)
.child(s
   .documentTypeList(`thing`)
   .id(`${thing?.id}`)
   .title(`item.title`)
   .apiVersion('v2024-04-01')
   .filter(........
Apr 24, 2024, 5:36 PM
or maybe you need to update that
apiversion
inside your schema or your api client configuration?
Apr 24, 2024, 5:41 PM
The first solution did the trick. Would this need to be updated after each sanity update?
Apr 24, 2024, 5:42 PM
I don't believe so, it came across as a breaking change.
That being said, I just update my version from an .env variable every first of the month.

I can imagine the date-based versioning easily creating a breaking change for future sanity updates that may require a feature that couldn't be backdated far enough to cover majority of user's configs. But that's also because I haven't looked into anything at all lol

definitely not something I'd do for all clients
Apr 24, 2024, 5:47 PM
Got it. Thanks for the help.
Apr 24, 2024, 5:47 PM
Hey
user M
, do you remember which version you were previously on?
Apr 24, 2024, 6:29 PM
I believe it was 3.30.1
Apr 24, 2024, 6:30 PM
Thanks!
Apr 24, 2024, 6:31 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?