Execution URL has a wrong domain

I have the following workflow error handler

N8N AUTOMATION HAS AN ERROR<br><br>
<b>Workflow Name:</b> {{ $json.workflow.name }}<br>
<b>Error Message:</b> {{ $json.execution.error.message }}<br>
<b>Execution URL:</b> {{ $json.execution.url }}

However every time I receive an email I see that Execution URL is leads to wrong domain. For example:

Instead of 
https://my-domain.com/workflow/4jHiDiW6tg0H8u6w/executions/146
I see
https://primary-production-30deb.up.railway.app/workflow/4jHiDiW6tg0H8u6w/executions/146

I’ve redeployed multiple times, however I still see wrong domain. In all other places domain is correct.

Information on your n8n setup

  • n8n version: 1.98.2
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • **Operating system:**Unknown, run on Railway
1 Like

It’s all in the env variables. Set N8N_EDITOR_BASE_URL in your env variables and give it a value of “https://my-domain.com”. This is per Deployment environment variables | n8n Docs

Then, in your workflow, you can now access this via the handy $env variable. Something like

Execution URL: {{ ${$env.N8N_EDITOR_BASE_URL}/workflow/${$json.workflow.id}/executions/${$json.execution.id} }}

Note that you won’t be able to see this value when typing in. You’ll see something like “[not accessible via UI, please run node]”. This variable only resolves at runtime for safety reasons. But it will run correctly and you’ll get the proper execution url. Let me know if it works.

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