Next.js Discord

Discord Forum

Private environmental variables returning undefined in middleware.js - Amplify

Unanswered
Wuchang bream posted this in #help-forum
Open in Discord
Wuchang breamOP
In my middleware.js file I use environmental variables. When using NEXT_PUBLIC, the variable correctly returns the desired value. However, when using a private variable, it returns undefined. This only happens when running on Amplify. Locally, using both run dev and start, the correct value is returned regardless of if it is private or public. Can this be due to a misconfiguration in NextJS or is it a limitation with middleware.js?

0 Replies