Error: Unable to resolve image URL from source (undefined) SANITY.IO

Viewed 1076

Error: Unable to resolve image URL from source (undefined)

I did my ImageBuilder configuration in another file and imported the urlFor function into my component. While I am able to map through/spread my values, I am not able to get the image url using the urlFor()

Running my queries in another file and importing a promise that I can handle with a useEffect()

useEffect(() => {
        const SLIDE = async () => {
            const slideItems = await SLIDES
            setSlide(...slideItems)
        }
        SLIDE()
    }, [])

I can access my data with the object properties. i.e: {slide.slide_title}

The thing is when I run the query from sanity studio, I get my values, and when I console.log too I get my values too BUT this urlFor(slide.slide_image).url() does not work for me.

What am I doing wrong?

0 Answers
Related