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

Error when uploading video in Sanity Studio, resolved by removing preview field

31 replies
Last updated: May 15, 2020
Anyone had this error before?
May 14, 2020, 8:50 PM
I have had it on my frontend.. It occured when I was trying to pass
assetId
instead of
_id
into imageUrlBuilder.. maybe you're doing the same
May 14, 2020, 8:52 PM
I’m getting this in the Studio, I was trying to upload a video to Sanity using the sanity-plugin-mux-input and it crashed to this screen. I get this every time I try and navigate to the document.
May 14, 2020, 8:53 PM
I’m not sure how to get rid of it
May 14, 2020, 8:54 PM
I understood you was in the studio, but thought you maybe did some hacking in the studio.. it's a good question how to delete the document.. I don't use groq but maybe you can solve it with https://www.sanity.io/docs/http-mutations
May 14, 2020, 8:56 PM
Are you able to get a hold of the JSON for that document?
Kind of looks like it expecting to get an image asset and gets something else.
May 15, 2020, 8:00 AM
Do you have any suggestions on how to? I’m pretty new to Sanity. I can’t use the inspector as the screen above stops me.
May 15, 2020, 11:56 AM
Can you do
sanity documents get your-document-id --pretty
May 15, 2020, 12:08 PM
also it would be helpful if you could post the schema for the document type that is failing
May 15, 2020, 12:09 PM
Thanks for the swift reply
May 15, 2020, 12:18 PM
The schema is:
May 15, 2020, 12:19 PM
import { MdFolder } from 'react-icons/md'

export default {
    name: 'project',
    type: 'document',
    title: 'Work',
    icon: MdFolder,
    fields: [
        {
            name: 'title',
            title: 'Title',
            type: 'string',
        },
        {
            name: 'slug',
            title: 'Slug',
            type: 'slug',
            options: {
                source: 'title',
                maxLength: 96,
            },
        },
            name: 'thumbnails',
            title: 'Thumbnails',
            type: 'array',
            layout: 'grid',
            of: [
                {
                    type: 'image',
                    options: {
                        metadata: ['exif', 'location', 'palette', 'lqip'],
                    },
                },
                { type: 'muxVideo' },
            ],
        },
        {
            name: 'gallery',
            title: 'Gallery',
            type: 'array',
            layout: 'grid',
            of: [{ type: 'image' }, { type: 'muxVideo' }],
        },
    ],
    preview: {
        select: {
            title: 'title',
            media: 'thumbnails.0',
        },
    },
}
May 15, 2020, 12:19 PM
And the mux field is:
May 15, 2020, 12:20 PM
export default {
    title: 'Video',
    name: 'muxVideo',
    type: 'mux.video',
}
May 15, 2020, 12:20 PM
How do I get the document id?
May 15, 2020, 12:20 PM
Hm... it should be in the url in your browser
May 15, 2020, 12:21 PM
if you post the url when you click the document I can dig it out for you 🙂
May 15, 2020, 12:22 PM
This is what’s in the URL when I hit that screen
May 15, 2020, 12:23 PM
can you right click and do copy link address on the document?
May 15, 2020, 12:24 PM
(in the document list)
May 15, 2020, 12:24 PM
The stack trace comes up before I can interact with the document list
May 15, 2020, 12:26 PM
Hm, ok, then it's probably related to your preview. Try removing that
May 15, 2020, 12:28 PM
media: 'thumbnails.0',
<-- remove that
May 15, 2020, 12:28 PM
Oh good point. It all works now
May 15, 2020, 12:29 PM
Thanks very much for your help. I should’ve realised that
May 15, 2020, 12:30 PM
No problem, glad we figured it out!
May 15, 2020, 12:33 PM
No problem, glad we figured it out!
May 15, 2020, 12:33 PM
Hm, ok, then it's probably related to your preview. Try removing that
May 15, 2020, 12:28 PM
media: 'thumbnails.0',
<-- remove that
May 15, 2020, 12:28 PM
Oh good point. It all works now
May 15, 2020, 12:29 PM
Thanks very much for your help. I should’ve realised that
May 15, 2020, 12:30 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?