I’m experiencing an issue with accessing environment variables in my self-hosted n8n setup. Expressions like {{$env["TEST"]}}, return null, and $env itself returns an empty object {}.
This used to work before (as referenced in this previous discussion: How to define custom environment variables available in the n8n workflow - #14 by sscarduzio ), but now it seems like environment variables are no longer accessible from workflows.
Information on your n8n setup
n8n version: 1.107.3
Running n8n via Docker
Environment variables are set on the system level
Has anyone encountered this issue recently? Any insights on what might have changed or how to troubleshoot this would be greatly appreciated.
Thank you for your help! I’ve set N8N_BLOCK_ENV_ACCESS_IN_NODE to false, but unfortunately that hasn’t resolved the issue yet. I’ll continue experimenting and will post back with the results.
I’m also experiencing the same - I’m using Render to host the instance (free plan), and adding the N8N_BLOCK_ENV_ACCESS_IN_NODE env var doesn’t seem to work for me.
Not sure if it’s a Render-specific thing, but when I go to generate the render.yaml file, it shows:
Interesting.. so even if it does show undefined, the value is still there?
I tried using process.env as well, but it still seems like it’s not being exposed.
As an example, when I’m setting up my Google Sheets credentials, the payload comes up empty for the secret from the OAuth callback:
Ok, it turns out it is a Render specific thing - the Secrets section in Render are used only during build time, and if it’s needed during runtime I’d need to have my own Docker build image vs pulling directly from the official n8n docker image.