I have deployed my MERN app on aws ec2 ubuntu and I am using dotenv to load my environment variables, using pm2 for the server and also using nginx.
In the server I am trying to load the values on my .env file which sits in the server directory, and read it into the client directory.
When printing this these values to the console from the client, it shows me only one old values which is the NODE_ENV variable. All other values printed are undefined.
I cant seem to reload anything.
I have tried to do the following separately:
delete the server running in pm2.
pm2 restart all --update-env
pm2 restart <pid> --update-env
pm2 reload
Reboot the aws instance.
pm2 reload ecosystem.json --update-env
which is not found.
And also trying to configure the path into dotenv.config({path: ...})
Nothing worked for me, who can help me with this issue please ?