Error in Sanity CMS causing crash, resolved by correcting `preview.prepare.media` value.

5 replies
Last updated: Jun 6, 2023
Hey! Have experienced the same crash ^ and also looking for an option to recall the cms' history? Am using ^3.10.0 version. Thanks!
Jun 6, 2023, 2:53 PM
hiya! 🙂 Yes this is my error. It only occurs when I'm running it locally (on Chrome). I've managed to get it back up for a while by changing the field names in a "Posts" schema, which is where this error is occurring, and then it crashed again. Only thing that helped was that it wiped all the CMS data.Console is showing this same error - have tried updating Sanity and still getting this same error. Grateful for any tips!
Jun 6, 2023, 5:33 PM
user B
This looks like you’re returning an empty string somewhere where a React component is expected. Do you have somewhere in your schema where you’re specifying an empty string (either as the value or a fallback value) for
preview.prepare.media
? For example:

preview: {
  select: {
    title: 'title',
    myImage: 'myImage',
  },
  prepare: ({ title, myImage }) => {
    return {
      title,
      media: myImage || '',
    };
  },
},
Jun 6, 2023, 5:43 PM
Right! My value was incorrect for my
media
specification for my
preview.prepare.media
. Thank you so much ❤️
Jun 6, 2023, 5:58 PM
Glad you got it straightened out! 🙌
Jun 6, 2023, 5:59 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?