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
질문됨 일 년 전110회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠