private env var undefined when logged
Answered
Asian black bear posted this in #help-forum
Asian black bearOP
in my
first 2 are prefixed with:
the third is not meant to be public, so it's not prefixed with
when i try to log it, i get
.env.local i have 3 env vars.first 2 are prefixed with:
NEXT_PUBLIC_* which are working and logging fine.the third is not meant to be public, so it's not prefixed with
NEXT_PUBLIC_*. it has an arbitrary name.when i try to log it, i get
undefined. what am i doing wrong?console.log(process.env.SUPABASE_SERVICE_ROLE_KEY)Answered by joulev
you are running this console.log on the browser maybe. non-next_public env vars dont work there
2 Replies
@Asian black bear in my `.env.local` i have 3 env vars.
first 2 are prefixed with: `NEXT_PUBLIC_*` which are working and logging fine.
the third is not meant to be public, so it's not prefixed with `NEXT_PUBLIC_*`. it has an arbitrary name.
when i try to log it, i get `undefined`. what am i doing wrong?
tsx
console.log(process.env.SUPABASE_SERVICE_ROLE_KEY)
you are running this console.log on the browser maybe. non-next_public env vars dont work there
Answer
@joulev you are running this console.log on the browser maybe. non-next_public env vars dont work there
Asian black bearOP
thanks a lot, it logs fine on the server.