.env.local file returning undefined
Unanswered
Chinese Alligator posted this in #help-forum
Chinese AlligatorOP
This is my .env.local file :
But when i do
It returns undefined
My file extension is .js
DISCORD_WEBHOOK_URL="https://discord.com/api"But when i do
console.log("Webhook URL:", process.env.DISCORD_WEBHOOK_URL);It returns undefined
My file extension is .js
8 Replies
Toyger
how are you using it? it can be used only in
if you want to use it in client side, you need to have prefix
Next.js data fetching methods and API routes.if you want to use it in client side, you need to have prefix
NEXT_PUBLIC_ for your env variablesI want to use it in server side
@Chinese Alligator I want to use it in server side
Toyger
ok, where exactly, in api route/route handler/server action/getstaticprops/etc...?
@Toyger ok, where exactly, in api route/route handler/server action/getstaticprops/etc...?
Chinese AlligatorOP
app/_actions/discord.js
Um
I think it got fixed
With using "use server" at the first