Struggling to add client-side environment variables

I am trying to add a client-side env variable to my env.mjs... I added it to the .env file, like so: FOO_URL=https://example.com/ Then I went to env.mjs and added it to client object like so: client: { NEXT_PUBLIC_FOO_URL: z.string().min(1), }, and also to the runtimeEnvobject like so: runtimeEnv: { NEXT_PUBLIC_FOO_URL: process.env.FOO_URL, }, When running the app I get: Unhandled Runtime Error Error: Invalid environment variables What am I missing?
Solution:
I fixed it... I changed the runtimeEnv object to the following: ` runtimeEnv: {...
Jump to solution
1 Reply
Solution
Yunis
Yunis2y ago
I fixed it... I changed the runtimeEnv object to the following: runtimeEnv: { NEXT_PUBLIC_FOO_URL: process.env.NEXT_PUBLIC_FOO_URL, }, Wasn't obvious to me tbh
Want results from more Discord servers?
Add your server