RANT: spent all day trying to get any kind of variable working in a node! FFS

Should be simple right - just want to avoid hard-coding an azure api url in all my nodes.

Neither for love nor money can I get environment variables to work (yes I’ve tried all kinds of N8N_BLOCK_ENV_ACCESS_IN_EDITOR type stuff).
“variables” is a paid feauture - :frowning:
There used to be a generic credentials provider, but apparently this has been removed, so no joy there.
Fed up!

Hey,

try this: GitHub - fefehun/n8n-nodes-globals-with-sections: N8N community node that allows users to create global constants organized into sections, and use them in all their workflows for multiple users.

services:
n8n:
image: n8nio/n8n:latest
environment:

This how I would set env variables and not the $var(on paid plan), and I still can reference the $env variable from OS/Docker .

So , your url request would look like this :

{{ $env.AZURE_API_BASE_URL }}/some/path

Cheers!

yes I spent hours trying this approach, and ones like it. ChatGPT thought the reason it wouldn’t work is some security stuff relating to the us of MCP and that if I turned off MCP it would work, anyway - I can say in my case the approach you’re suggesting did not work.

1 Like

thank you Kool_Baudrillard. I guess this shows I’m not the first to trip over this.

I’ll try Kool_Baudrillard’s solution at some point, but I was able to get past this with “Set” nodes for now - and ugly syntax like:

{{ $(‘Set Inputs’).item.json.azUrl }}