You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this package when doing some research on how to pass the variables defined in GCP's Cloud Run to a Next.js 13 project using the App Router feature.
After the installation, I imported and passed the PublicEnvProvider in the app folder layout.tsx and then use useEnvContext to make the client side variables available to client components. The client required variables defined in the Cloud Run's revision were prefixed with NEXT_PUBLIC_. I couldn't make it worked, when I console log the variables all I got was the .env hard coded values.
I also tried using the makeEnvPublic function to avoid using the NEXT_PUBLIC_ prefix also without luck.
Is this an appropriate use case for the package? Perhaps I'm doing something wrong? Sorry for the beginner question, first time deploying Next.js to a cloud service.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
Hope everything is going well.
I came across this package when doing some research on how to pass the variables defined in GCP's Cloud Run to a Next.js 13 project using the App Router feature.
After the installation, I imported and passed the
PublicEnvProvider
in the app folderlayout.tsx
and then useuseEnvContext
to make the client side variables available to client components. The client required variables defined in the Cloud Run's revision were prefixed withNEXT_PUBLIC_
. I couldn't make it worked, when I console log the variables all I got was the.env
hard coded values.I also tried using the
makeEnvPublic
function to avoid using theNEXT_PUBLIC_
prefix also without luck.Is this an appropriate use case for the package? Perhaps I'm doing something wrong? Sorry for the beginner question, first time deploying Next.js to a cloud service.
Any insights will be greatly appreciate it.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions