I have a self hosted N8N and i thought of rebuilding it from scratch going straight to v2.0.3. Had so many obstacles, but managed get it running, Migrated the Data successfully.
Problem Statement: After deploying N8N v2.0.3 on Ubuntu 25.04 (GCP), Code nodes fail with:
* [ERROR: access to env vars denied]
* Task request timed out after 60 seconds
1. Initial Diagnosis: Missing Task Runner
* Issue: N8N v2.0 requires external task runners for Code nodes
* Fix Attempted: Added n8nio/runners:latest container to docker-compose
* Result: Task runner started but couldn't authenticate
2. Authentication Problems (404 Errors)
Symptom
ERROR [launcher:js] Failed to fetch grant token: status code 404
Fixes Attempted:
* Set N8N_RUNNERS_AUTH_TOKEN on both n8n and task-runner services
* Changed broker URI from :5679 to :5678 (then back to :5679 based on logs)
* Added N8N_RUNNERS_GRANT_TOKEN_EXPIRY=60000 to extend timeout
* Removed healthcheck dependencies that were blocking startup
Result:Task runner successfully connected to n8n
3. Environment Variable Access Denial
Symptom:
[ERROR: access to env vars denied]
N8N_BLOCK_ENV_ACCESS_IN_NODE is set to true
Fixes Attempted (ALL FAILED):
Attempt A: Using N8N_RUNNERS_TASK_ENV_ALLOW_LIST
environment:
- N8N_RUNNERS_TASK_ENV_ALLOW_LIST=TELEGRAM_CHAT_ID,OPENAI_API_KEY,...
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
- OPENAI_API_KEY=${OPENAI_API_KEY}
Why it failed: Environment variable alone is insufficient in v2.0
Syntax wasn't the issue
Attempt B: Setting N8N_BLOCK_ENV_ACCESS_IN_NODE=false
# On n8n container:
- N8N_BLOCK_ENV_ACCESS_IN_NODE=false
Why it failed: This only affects the n8n main process, not the isolated task runner
Attempt C: Mounting /etc/n8n-task-runners.json Config File
With config:
{
"runners": {
"javascript": {
"allowed-env": ["TELEGRAM_CHAT_ID", "OPENAI_API_KEY", ...]
}
}
}
```
** failed**: Still getting access denied errors (current state)
### Working:
- N8N web interface accessible
- Task runner container running and connected
- Task runner can fetch grant tokens
- Workflows execute (but Code nodes fail)
### NOT Working:
- Environment variable access in Code nodes
- Code nodes still timeout after 60 seconds
- `$env.VARIABLE_NAME` returns access denied
### Current Errors:
```
1. Task request timed out after 60 seconds
2. [ERROR: access to env vars denied]
3. ValidationError: X-Forwarded-For header with trust proxy false (cosmetic, doesn't affect functionality)
```
Current Architecture:
Nginx Proxy (port 443) -->N8N Main (port 5678) ←─────→ Task Runner :5679 (isolated env)
---> PostgreSQL (port 5432)