private env variables in Nextjs
Unanswered
Cassin's Finch posted this in #help-forum
Cassin's FinchOP
i'm trying to make a env variable private and not public (the last one), but i cant access it in the project but i get 'undefined'
18 Replies
do you call it on the server side or client side?
because private env vars are only for the server side
@Bashamega because private env vars are only for the server side
Cassin's FinchOP
we are using /pages & we are not using 'use serevr' or 'use client'
i guess all of the app is used in client side
You can try loading it with
@next/envYou can not access secret/private environment variables in the client. Anything accessible in the client will not be secret/private.
Giant panda
Just curious how would one view a next_public env variable shared to the browser
Is it exposed as JavaScript?
it will be bundled into the clientside source at compile time
Giant panda
ahh ok
Giant panda
just curious, would it be ok if i released an app with the open ai api in next_public?
Giant panda
oh yea
the key
no