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
已提問 1 年前檢視次數 111 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南