[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# Env variables not working

279 views · 4 likes · 3 posts


Sia (@siavoshzarrasvand) · 2024-08-09

Hey, 

Our env variables are not being picked up. We have tried the following: 

1) set them in the vercel UI, then fetch them with process.env.MY_ENV_VAR.

When that failed, we tried

2) set them in the UI, then import and export them in config.next.mjs, according to these guidelines: https://nextjs.org/docs/pages/api-reference/next-config-js/runtime-configuration

When that failed we tried asking Claude, and the Help chat function. But there were no suggestions from them that were different to what we tried. 

Would need a bit of guidelines...


Sia (@siavoshzarrasvand) · 2024-08-09 · ♥ 2

Seems to stem from a lack of understanding between shared and normal environment variables, and the fact that the former have to be linked.


Pauline P. Narvas (@pawlean) · 2024-08-09 · ♥ 2

Hey, @siavoshzarrasvand!

Thanks for coming here after [your tweet](https://x.com/siiiaaaaaaa/status/1821828769801281551) and sharing a solution! :raised_hands: