Amplify Next.JS Hosting Env Var Accessible during getInitialProps

0

I am hosting a NextJs 13 App on Amplify. In my custom _app.tsx file, I have a getInitialProps function that references an env-var not prefixed with NEXT_PUBLIC_. This means that the variable will not be accessible outside the Node runtime. However, the initial load of getInitialProps runs on the server, so this shouldn't be a problem.

However, when trying to access the variable, it is undefined. Other env-vars that are prefixed with NEXT_PUBLIC_ are, which means the process is not running on Node.

The app works as expected when run locally, which leads me to think this is an issue with how Amplify hosts the app.

engkiwi
asked a year ago108 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions