I had been struggling to understand why my .env variables have been printing "undefined" for a while now which had set me back on my project. Thanks to your explanation, I now understand that its because Nextjs won't render the .env variable in the client side but only to the server side. Thank you so much!
the best video for env on nextJS but still it does not work for me specifically for priority points like running on the development server still m getting value from the .env file rather than .env.development. can you please help me with this?
Hey Mayank, loved the video i just had one thing to ask you, you see i made a website using next and getServerSideprops and deployed to netlify but whenever i open the link it gives me 500 internal server error. i have other pages where i havent used server side props and in that same website and when i navigate to those pages using url those pages works fine , only pages where i use server side props give 500 internal server error hope you see this and waiting for a solution :)
Hey Nihal, a 500 error is thrown when there is a failure on the server side. The issue is likely with the implementation of your getServerSideProps function eg. API endpoint not available, env variable not loading etc. Can you share the function so I can take a look
Hi Mayank, Great Content bro, it helped me in knowing which command to run the app in prod env. i was struggling to find out this from past two hours. also can you tell which command to run the app in staging/test env. basically i want to know how to set the app to read .env.test for ex: if we "yarn dev", it is taking .env.local if we run "yarn start", it is taking .env.production what is it for .env.test??
Go watch my new video on deploying Next.JS apps on the web: ua-cam.com/video/ACYbIVvdPq0/v-deo.html
Great video 👏
Thank you!
I had been struggling to understand why my .env variables have been printing "undefined" for a while now which had set me back on my project. Thanks to your explanation, I now understand that its because Nextjs won't render the .env variable in the client side but only to the server side. Thank you so much!
Glad I could help
the best video for env on nextJS but still it does not work for me specifically for priority points like running on the development server still m getting value from the .env file rather than .env.development. can you please help me with this?
sure, will get back to you
Extremely useful! Thank you!
Very useful. Thank you
Glad it was helpful!
THANKS SO MUCH IT HELPED A LOTT!!!!!
Glad I could help
Thanks! great content! I have a request. Please use the latest version of Nextjs and any other package you use like apollo, or RTK
Great content, thanks
Thank you
Hey Mayank, loved the video i just had one thing to ask you, you see i made a website using next and getServerSideprops and deployed to netlify but whenever i open the link it gives me 500 internal server error. i have other pages where i havent used server side props and in that same website and when i navigate to those pages using url those pages works fine , only pages where i use server side props give 500 internal server error
hope you see this and waiting for a solution :)
Hey Nihal, a 500 error is thrown when there is a failure on the server side. The issue is likely with the implementation of your getServerSideProps function eg. API endpoint not available, env variable not loading etc.
Can you share the function so I can take a look
Hi Mayank, Great Content bro, it helped me in knowing which command to run the app in prod env. i was struggling to find out this from past two hours.
also can you tell which command to run the app in staging/test env.
basically i want to know how to set the app to read .env.test
for ex:
if we "yarn dev", it is taking .env.local
if we run "yarn start", it is taking .env.production
what is it for .env.test??
while running your app in test mode, basically for e2e and unit tests