πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Undefined - SANITY_STUDIO_A = 'a' in Env 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
SANITY_STUDIO_A = 'a'
. 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
.env
file to
.env.development
? I think it needs
.env.development
when running
sanity start
or
.env.production
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?