No access to $env

I get this kind of error for $env. “access to env vars denied”. How can I allow the access?

Just dreaming: I guess, there needs to be a simple custom variable management. Via Settings, for example. Not using config files on the server.


Hi Artildo,
normally you can enabled/disable access to environment variables using N8N_BLOCK_ENV_ACCESS_IN_NODE. By default this is false allowing you to access environment variables.

I just tried it myself with MY_ENV=test_value and It looks like we have a little bug when previewing expressions like {{ $env.MY_ENV }}, because it worked when running the workflow.

Can you try to use your environment variable and ignore the error for now. I will create an internal ticket to fix the issue.


@marcus, that works, thank you!

For some context, you can access workflow errors at runtime, but only for automated executions. Not for manual ones from UI, because these env vars aren’t available in the front end.

This isn’t so much a bug as a known limitation that has an unclear user-facing error. Currently, n8n will always show that error when running manually. We just groomed a ticket to clarify the error, so is on the board for updating.

If you’d like to access env cars from the UI, I’d recommend making a feature request, so it can be voted on by the community and prioritized. Thanks!


I have a node that uses loadOptionsMethod to fulfill the parameter options. This node also uses a $env variable in another parameter. In older version loadOptionsMethod successfully loaded the options although the $env is undefined in the runtime.
But when I updated n8n to 0.214.0, loadOptionsMethod doesn’t load and it says “access to env vars denied”. But other parameter uses the $env!
Why this parameter complains about it? the loadOptionsMethod has nothing to do with the $env!

Could you help plz?

Hey @jellybean,

That is a bit odd, What version were you running before 214?

Version: 0.188.0

New version [email protected] got released which includes the GitHub PR 5634.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.