👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

If I can query images directly from Sanity, what is @sanity/Image-url needed for?

12 replies
Last updated: Aug 22, 2022
Hi 👋 folks. I’m curious: if I can query my images directly from Sanity, why do we need
@sanity/image-url
?
Aug 22, 2022, 11:05 AM
Sometimes it’s easier to use than doing it in GROQ. 🙂
Aug 22, 2022, 11:43 AM
Hmm, that's great. I just can't get it to work with Remix so I was wondering if it had some huge advantage.
Aug 22, 2022, 11:46 AM
What’s not working?
Aug 22, 2022, 11:48 AM
This piece of code. When I use the function, it errors
Aug 22, 2022, 11:49 AM
Which error? 🙂
Aug 22, 2022, 11:50 AM
Here. I’m working with Remix
Aug 22, 2022, 11:51 AM
Oh wow, that is not a helpful error.
Aug 22, 2022, 11:51 AM
Yes, it isn’t. This is the output from the log. The
baseUrl
is
undefined
Aug 22, 2022, 11:53 AM
I mean, it did work because your asset gets resolved.
Aug 22, 2022, 11:56 AM
(Next time please don’t share a screenshot of your token. This is a sensitive piece of information.)
Aug 22, 2022, 11:56 AM
Thank you for that. I forgot
Aug 22, 2022, 11:57 AM
yes, it got resolved. So I figured the problem is with Remix
Aug 22, 2022, 11:57 AM

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?