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.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in