• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Node environment variables not returned by process.env

basdebruin

New Pleskian
Plesk Obsidian 18.0.36 / Ubuntu 20.04.3 / Node 14.18.0

process.env.XYZ does return undefined while XYZ is set as a custom environment variable. Other variable are returned fine. Is there a maximum to the number of environment variables or the total nr of characters in them? Removing one of the working environment variables does not solve the issue, so it does not look like it runs into a maximum.
 
So Plesk doesn't forward the ENV Vars to custom scripts (don't ask me why), but this will pass them to it if you run it as part of the command:
export $(cat ./location/of/.env | xargs) && node ./index.js // or whatever command you are trying to run that has methods referencing env vars.

Hope this helps
 
So Plesk doesn't forward the ENV Vars to custom scripts (don't ask me why), but this will pass them to it if you run it as part of the command:
export $(cat ./location/of/.env | xargs) && node ./index.js // or whatever command you are trying to run that has methods referencing env vars.

Hope this helps
I had Plesk with CloudLinux on a CentOs7, and the custom environment variables worked perfectly.
Last month, however, I switched to a new system with Plesk on Ubuntu 20, and now the custom environment variables don't work anymore.
Would this be a permissions issue?
 
Back
Top