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!