All Questions

Tagged with
Filter by
Sorted by
Tagged with
11 votes
10 answers
16k views

Sanity.io [vite] Internal server error: [postcss] Cannot read properties of undefined (reading 'config') error

Spinning up the sanity studio gets me this error. The page spins up just fine in local host. Any help fixing this would be greatly appreciated here is the error in full: [plugin:vite:css] [postcss] ...
toadlyfe's user avatar
  • 441
11 votes
3 answers
3k views

Sanity Studio: Parsing Error for Babel Preset Env

I'm new to working with Sanity, and just set up a project. Everything is working fine, however, in Visual Studio Code, I keep getting a parsing error that won't disappear, and I'm wondering how I can ...
Jon Lothar's user avatar
9 votes
1 answer
5k views

How to upload multiple images to sanity.io?

I am searching for a way to uploading multiple images to sanity.io. Only thing that I found is this issue. But maybe there is another way. Some npm-plugin or node.js app approach. I'll be grateful ...
Daria Moreno-Gogoleva's user avatar
7 votes
1 answer
5k views

How to create default value in field using sanity.io?

Is it possible to add to sanity field with default value? How can I extend it? I want to create some fields with default variables. For example I have this code: export default { name: 'name', ...
kizoso's user avatar
  • 1,216
5 votes
1 answer
2k views

How to set value through patch event to any field from custom input in sanity.io?

I want to make patch event from custom component and set a value to another field in document, but couldn’t find documentation about patch events. there are only example without field specification: ...
Daria Moreno-Gogoleva's user avatar
4 votes
1 answer
526 views

How to import custom CSS in Sanity Studio v3

I would like to make a small CSS modification in Sanity Studio V3. The old method to import CSS no longer works. How can I do it?
Jeremy's user avatar
  • 1,914
4 votes
4 answers
4k views

Uncaught Error: Configuration must contain `projectId`( when using environment variable )

Only when using an environment variable for projectId inside sanityClient, it can't find it even though is inside the .env file My goal is to connect backend data from Sanity to my frontend in ...
kebron solomon zerie's user avatar
4 votes
1 answer
1k views

Next.js - How to use getStaticProps to fetch Menu data and then pass it to the layout?

I am using Sanity.io as a backend, within Sanity I am handling the data for my main menu (parent/children object arrays). Whilst I can fetch this data just fine, I want to do so via getStaticProps, as ...
richtea's user avatar
  • 71
4 votes
0 answers
219 views

Getting fetch error when deploying Nextjs / TS app to Vercel

Im getting this error when I try to deploy an app using Nextjs / TS / Sanity to Vercel 18:39:44.458] Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/...
Endugu's user avatar
  • 41
4 votes
1 answer
554 views

Vercel deployment: Error occurred prerendering page "/" TypeError: fetch failed

Yesterday I deployed my project (using Sanity.io) to Vercel and no issue. Today I edited my code and want to deploy the new version with this commands: vercel build vercel deploy --prebuilt vercel --...
Théo's user avatar
  • 43
3 votes
1 answer
1k views

How to define a tokenized tag field in Sanity?

I've seen people sport beautiful tokenized tag-fields in their Sanity studios. I don't think they are using a plug-in, so what's the incantation that will turn my homely array of strings into a ...
thomax's user avatar
  • 9,410
3 votes
1 answer
3k views

How to import CSV to sanity.io

Im a hobby programmer exploring the free version of the new headless CMS sanity (www.sanity.io). Bumping into a problem when trying to upload / import data into my project: Is there a way to import ...
Magnus Hillestad's user avatar
3 votes
1 answer
687 views

How to filter references based on change in another reference?

I have created an object with 3 reference fields - categories, subcategories, and types. I want the subcategories to show subcategories related to the selected category. { title: "Product ...
user avatar
3 votes
1 answer
839 views

Sanity IO CMS - What is the difference between sanity.config.js and sanity.json

Working with a Version 3 Sanity project to provide backend data. However, I noticed that there are two files that deals with project settings/configurations. PROJECT_DIR/sanity.config.js - included ...
0x5929's user avatar
  • 440
3 votes
1 answer
1k views

Next JS Rewrites for Sanity CMS giving 404 page after login

I'm currently hosting a Next JS site on Netlify with a Sanity CMS backend for content editing. I've got it configured to run on the single domain IE - examplesite.com has the front-end website, where ...
Isaac King's user avatar
3 votes
1 answer
640 views

Error: Duplicated files or mocks. ReactNative-Expo-sanity.io

so have been developing a react native app using Expo and sanity.io as back-end, when I implemented sanity as backend i started getting an error just on the mobile versions(ios simulator, and andorid ...
sebastian velez's user avatar
3 votes
1 answer
284 views

Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error

I received a github repo backup from somebody elses account. The project is running gatsby, sanity cms and is hosted via netlify. When I extract the archive and saving the folder locally, I am ...
user5123123's user avatar
3 votes
1 answer
299 views

Escape HTML entities and render URL dynamically

The problem can be seen here I built a site using Sanity headless CMS and GatsbyJS on the frontend. I'm querying URLs dynamically so that it can be rendered inside the src attribute of an </iframe&...
Null isTrue's user avatar
  • 1,892
3 votes
1 answer
215 views

Error while connecting sanity content lake to frontend

I'm getting an error while fetching blogs from sanity to my template, I'm creating a next.js website Error: Error: Unknown block type "undefined", please specify a serializer for it in the ...
Sushant Bansode's user avatar
3 votes
0 answers
1k views

TypeError: url.parse is not a function (fetching data from sanity.io)

I have been stuck on this thing for a week now. I am trying to fetch data from Sanity (http://sanity.io/) within a Vue (Vite) project, doing it exactly as this guide is showing: https://www.sanity.io/...
Blastius's user avatar
2 votes
4 answers
1k views

Sanity Error: `dataset` must be provided to perform queries with React

I'm trying to create a blog with Sanity CMS; when I try to get data from Sanity database i get that "Error: dataset must be provided to perform queries" I got client.js component with ...
Sebastian Lewy's user avatar
2 votes
2 answers
563 views

How to define NOT is sanity.io structure builder?

I'm trying to filter all products without categories (which is array of references) and can't find how to do it. S.listItem() .title('Without category') .id('productsWithoutCategories') ....
Daria Moreno-Gogoleva's user avatar
2 votes
1 answer
4k views

Customizing schema fields in sanity.io

In sanity studio schema I made some object type with one field, dependent of other. If "all" field check to true, then "date" field should be hidden or disabled. But I don't know ...
Daria Moreno-Gogoleva's user avatar
2 votes
1 answer
2k views

Sanity.io, is any way to to change field type painlessly?

I have quite a lot documents in the sanity.io with completed fields. There is a need to change field type. And here are the problem: Now I need to rewrite this field from old to the new and delete ...
kizoso's user avatar
  • 1,216
2 votes
2 answers
344 views

Error: No "sanity.json" file found in plugin "@sanity/vision"

As I was creating my new sanity project on my terminal while running "sanity init" during the process I received an error of: "Error: No "sanity.json" file found in plugin &...
MegaMindTheCoder's user avatar
2 votes
2 answers
290 views

How to remove a specific document from sanity desk structure?

I added the media library plugin to my sanity structure builder but want to remove the 'media tag' document that gets created by the plugin However, you can override this behaviour by defining your ...
Burger Sasha's user avatar
2 votes
3 answers
4k views

Module not found: Can't resolve '@sanity/client'

I keep getting this error on localhost Failed to compile ./lib/client.js:1:0 Module not found: Can't resolve '@sanity/client' > 1 | import sanityClient from '@sanity/client'; 2 | import ...
DiwSlow's user avatar
  • 21
2 votes
1 answer
878 views

Convert String type to slug type for sanity io

I am importing data from an external API into my sanity schema and the API contains the slug in the form of a string. I have tried removing the double quotes of the string and making it single quoted ...
Marium Ali's user avatar
2 votes
1 answer
1k views

Order by random in Sanity.io GROQ query not working?

Sanity.io is awesome! But as I'm just beginning, I cannot find some things yet I know in e.g. MySQL. According to the GROQ cheat sheet I should be able to randomly sort and slice (LIMIT + OFFSET in ...
Jos's user avatar
  • 1,474
2 votes
2 answers
2k views

How do I fix a 'Missing enviornment variable' in Sanity?

I have tried everything to fix it but still getting the error Uncaught error: Missing environment variable: NEXT_PUBLIC_SANITY_DATASET http://localhost:3333/static/sanity-5377bc10.js:4605:43956 Error:...
I byte's user avatar
  • 21
2 votes
1 answer
84 views

Next Js Api routes response helpers (redirect)

I'M trying to create a login functionality in Next js. Everything is pretty much done but I'm unable to redirect to homepage after login. I'm using Next js with sanity as headless CMS This is my login ...
NexCodes's user avatar
  • 131
2 votes
1 answer
82 views

Dynamic pages at load time, not build time

I'm building an editorial site that regularly adds new content. As such, they've requested that articles and article content is loaded in at load time rather than having to run a build and wait for it....
Chrish D's user avatar
2 votes
0 answers
455 views

Cannot read properties of undefined (reading 'length') Lottie React

I get an undefined issue while trying to set lotties using lottie-react I am setting CDN link instead of just importing it directly . This is the code : {missions.map((mission : any) => ( <...
Yaakoubi Mohammed's user avatar
2 votes
0 answers
2k views

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

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/...
Badt0men's user avatar
  • 263
2 votes
1 answer
290 views

How to read/pass vercel system enviroment variables to code in Sanity?

I want to pass the VERCEL_GIT_COMMIT_REF variable to my javascript bundle. I've deployed Sanity in Vercel and it only passes variables with the prefix SANITY_STUDIO_. So, I've created an environment ...
Hariharan K's user avatar
2 votes
0 answers
490 views

Sanity CMS, referencing arrays within a document

My goal is to have a custom internalLink mark that is able to reference not just the post (which is easy enough since its a type: document) but also reference name: sections which returns array of ...
umbriel's user avatar
  • 732
2 votes
4 answers
1k views

I am building a React Application using the Sanity CMS for the backend but I am running into a client error when sending data to the backend

I am building a react application and using a Sanity CMS for the backend but I am running into an issue whenever I try to load data into the backend from the client. Everything else works perfectly ...
coding beast's user avatar
1 vote
5 answers
938 views

Sanity CMS data is not showing on the react app

I was following a tutorial on youtube (https://youtu.be/3HNyXCPDQ7Q) for creating a portfolio website. I hosted the website using Netlify, 20 days later when I revisited the website, the website was ...
pppratspota's user avatar
1 vote
2 answers
453 views

Vercel Build Error: It looks like you're using options meant for '@sanity/preview-kit/client'

Hi Im having an odd issue with Vercel deployment because of sanity, this is the Vercel build error: Error: It looks like you're using options meant for '@sanity/preview-kit/client', such as '...
André Gomes's user avatar
1 vote
1 answer
2k views

How to delete a document attribute in Sanity iO?

I have an array of objects in my Sanity Document called Images called Comments an example comment object in comments[] array looks like : { "_key": "6510dc79cf8b", &...
dev's user avatar
  • 285
1 vote
2 answers
656 views

Debugging Sanity exec with VS Code

I'm using Sanity (sanity.io headless CMS) and doing some data migration with the CLI. How do I (or, is it at all possible) to some how attach the vscode debugger and stop at breakpoints in migration ...
cfm's user avatar
  • 196
1 vote
2 answers
791 views

Angular4 Injecting Service class - code in constructor not finished when service method called?

I'm trying to get into Angular4/5. I have a connection to a CMS service called Sanity (https://www.sanity.io/). The issue I am having is that this service is injected to a ProductsComponent class and ...
Pippy Longstocking's user avatar
1 vote
1 answer
1k views

Sanity with React BlockContent displays only plain text

Ok, so I am working on a blog for my portfolio website, and I just got it working until I realized that when I style the body of my blog posts in Sanity Studio, those styles do not transfer to the ...
Brandon Pyle's user avatar
1 vote
1 answer
51 views

how to get a portion of useState stored data in another useState

In the project that I am working on currently I am fetching data from sanity and storing that data in a useState(), and that data is a collection of multiple restaurants, each restaurant has different ...
Abdellah Slimani's user avatar
1 vote
1 answer
1k views

Sanity GROQ query to not return nullish values

I was querying Sanity with GROQ and wanted to get response excluding nullish values in case there is no image url is available but if it is then return the image url. Doing like this: defined(image) =&...
Suleman Ahmad's user avatar
1 vote
1 answer
17 views

Error: setAllcategories is not a function

Working currently with Nextjs and Sanity as Headless CMS for the backend part. As you can see down below I made a Categories.js file in components folder an trying to fetch some datas. I want to take ...
Remo Furrer's user avatar
1 vote
1 answer
224 views

How to deploy React + Sanity app to Netlify

I currently worked on a Portfolio web application built using React and Sanity.io. After deploying to Netlify, all content in the Sanity was not showing. Please, what am I not doing right? I noticed I ...
Dennis Akagha's user avatar
1 vote
1 answer
542 views

Sanity.io code input – how to add an input field for highlighted lines?

I've stuck trying to add highlightedLines field to Sanity.io code input. The only docs I've found yet are on npm page of the module, and there is an example data model: { _type: 'code', language: '...
HynekS's user avatar
  • 2,954
1 vote
1 answer
419 views

React update state of component after search through object

I have an object that is outputted from the reactIcons npm package https://www.npmjs.com/package/react-icons I am importing everything from one of the folders with import * as ReactIcons from 'react-...
Anders Kitson's user avatar
1 vote
1 answer
762 views

why does my API route in next.js is giving 404 error

why does my fetch request gives me the error "GET http://localhost:3000/api/db/getRideTypes 404 (Not Found)" when trying to fetch data from sanity client. The partial code of Rideselector.js ...
Damith Tharuka's user avatar