Troubleshooting dataset import and env variable issues with Vercel deployment

20 replies
Last updated: May 3, 2021
I exported my development dataset.Then I imported my development dataset into production.

Now I get this error message:

Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 20 characters
Does anyone know how to troubleshoot this?
Where can I find the name of the dataset?
Shouldn't it just be "production"?
May 3, 2021, 9:14 PM
First i renamed development.tar.gz to production.tar.gzThen i ran:
sanity dataset import production.tar.gz production --replace
May 3, 2021, 9:19 PM
And i gotDone! Imported 71 documents to dataset "production"
May 3, 2021, 9:19 PM
Interesting. I just did the exact same commands (just from production to dev) and it’s working. In sanity.json, is
api.dataset == "production"
?
May 3, 2021, 9:38 PM
Interesting. I just did the exact same commands (just from production to dev) and it’s working. In sanity.json, is
api.dataset == "production"
?
May 3, 2021, 9:38 PM
It actually works locally.But it does not work with Vercel.

I have the following env variable in Vercel
SANITY_STUDIO_API_DATASET
production sanity build
May 3, 2021, 9:42 PM
I followed these instructions once in a time:
https://www.sanity.io/docs/studio-environment-variables
May 3, 2021, 9:42 PM
Is this your studio that you’re deploying to Vercel?
May 3, 2021, 9:50 PM
Is this your studio that you’re deploying to Vercel?
May 3, 2021, 9:50 PM
Yes
May 3, 2021, 9:50 PM
Did this ever work for you on your dev dataset? Or is this the first time you’ve tried deploying it?
May 3, 2021, 9:51 PM
Is the Vercel URL for your studio added in CORS Origins with credentials?
May 3, 2021, 9:51 PM
It has worked for over a year.And I have deployed the studio earlier today.
It stopped working after I imported the dataset.
May 3, 2021, 9:53 PM
Okay, that’s good to know. I will try passing this up the chain.
May 3, 2021, 9:54 PM
Thanks 👍
May 3, 2021, 9:57 PM
Just to confirm, is this a build error (that therefore left production intact) or has it disrupted your production environment?
May 3, 2021, 9:58 PM
I don't get any build errors. And if I change something in the studio locally with "dataset": "production", I can see the changes in the production site.But I cannot access the sanity studio that is deployed to production.
May 3, 2021, 10:01 PM
I just tested to remove the env variable from Vercel and use "dataset": "production" in sanity.json and it works.There seems to be a problem with using the following env variable in Vercel.


SANITY_STUDIO_API_DATASET=production sanity build
May 3, 2021, 10:33 PM
Great! I’m confused how it worked before but happy it’s working for you. 🙌
May 3, 2021, 10:34 PM
I have just followed this part: https://www.sanity.io/docs/studio-environment-variables#4fab9317f4ad
I don't know if that solution has stopped working.
May 3, 2021, 10:36 PM
I have just followed this part: https://www.sanity.io/docs/studio-environment-variables#4fab9317f4ad
I don't know if that solution has stopped working.
May 3, 2021, 10:36 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?