Next.js Discord

Discord Forum

cloudflare pages undefined environment variables

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
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

13 Replies

IDK much about cloudfare pages, but you have added the environment variables under settings right?
@averydelusionalperson IDK much about cloudfare pages, but you have added the environment variables under settings right?
Sloth bearOP
yep, it shows the environment variables along with the deployment
where are you getting those as undefined?
In Next.js application?
Sloth bearOP
in ssr pages
@averydelusionalperson In Next.js application?
Sloth bearOP
yeah
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
Hey @Sloth bear , did you found the solution?
Hackberry nipple gall parasitoid
Any updates on this one?
Southern rough shrimp
@Sloth bearexactly what is the name of the environment variable which is undefined