✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Using environment variables in a Sanity schema file

2 replies
Last updated: Apr 28, 2020
I need to use environment variable in one my schemas file, from .env file. I created .env file, wrote
. After that write
console.log('process.env.SANITY_STUDIO_A: ', process.env.SANITY_STUDIO_A);
but in the console I have undefined? What I did wrong?
Apr 28, 2020, 1:49 PM
Hi kizoso, have you tried renaming the
file to
? I think it needs
when running
sanity start
when running
sanity build
(or a deploy of your Studio).
Apr 28, 2020, 2:13 PM
Thank you so much! It helps!
Apr 28, 2020, 2:18 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?