Next.js Discord

Discord Forum

cloudflare pages undefined environment variables

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
Avatar
Sloth bearOP
does anybody know why environment variables are undefined when hosting a next.js project on cloudflare pages? they show up under build settings on the cloudflare pages build

11 Replies

Avatar
Princess Tsundere
IDK much about cloudfare pages, but you have added the environment variables under settings right?
Avatar
Sloth bearOP
yep, it shows the environment variables along with the deployment
Avatar
Princess Tsundere
where are you getting those as undefined?
In Next.js application?
Avatar
Sloth bearOP
in ssr pages
yeah
Avatar
Princess Tsundere
I never used cloudfare pages, but you need to access .env in particular way in cloudfare pages if I'm not wrong.
I'm not sure tho, you can check ^ this out
Avatar
Princess Tsundere
Hey @Sloth bear , did you found the solution?