Workflow into production webhook error

Hello,
I am experiencing an issue with a workflow that uses a Gmail Trigger and gmail node: send message and wait for response.
When I was testing the workflow manually from the editor (clicking on the button execute workflow), the feedback link (where I can put a text giving feedback on the response) was correctly generated with the public URL of my n8n instance deployed on Railway (https://......railway.app). In this scenario, the workflow functioned without any problems.
However, when I activate the workflow to run automatically (in production mode), the link sent via email for giving feedback always starts with http://localhost:5678/.... This prevents the workflow from continuing, as the URL is not accessible from outside the local machine.
I have verified that the WEBHOOK_URL environment variable is correctly configured in my Railway deployment with the public URL of the instance. . Despite this, the problem persists.
Could you please help me understand why the active workflow is not using the WEBHOOK_URL variable and is instead generating the localhost URL?
Thank you for your assistance.
Best regards

Captura de pantalla 2025-08-13 192508

Captura de pantalla 2025-08-13 192641

Hello @tlpui

Could you share your docker command where you are using the WEBHOOK_URL environment variable

Below you can find the example command which should work OK:

docker run -it --rm --name n8n -p 5678:5678 -e WEBHOOK_URL=https://mycustomurl.com/ -v n8n_data:/home/node/.n8n docket.n8n.io/n8nio/n8n

Notice https:// and trailing / (slash)

Can you also share a simpler workflow for Gmail Trigger and Gmail node for : send message and wait for response that can reproduce the issue?

Hello,

Thank you for your response and the Docker command example. I am deploying my n8n instance using a Docker container on Railway. Therefore, I cannot directly execute the docker run the command you provided me.

As you can see in the attached screenshot, I have configured the WEBHOOK_URL environment variable with my public Railway instance address (https://...railway.app), just as you advised.

Despite this variable being correctly set, the problem persists:

  • In test mode (within the editor): The webhook link is generated correctly using the Railway URL.

  • In production mode (active workflow): The webhook link sent via email always starts with http://localhost:5678.

To rule out any issues with my original workflow, I have created a much simpler one that still shows the same error in production.

I hope we can somehow reach to a solution.

Thank you for your time and help.

Best regards

Captura de pantalla 2025-08-14 105044

Captura de pantalla 2025-08-14 104958

I have recently tried to add the variables as well. Nevertheless, the result is still the same: it shows ‘localhost’ when triggered automatically, but the normal URL when done manually.

N8N_HOST = .....railway.app

N8N_PROTOCOL = https

N8N_EDITOR_BASE_URL = https://....railway.app

Hello @tlpui

Thank you for the additional information. It will be helpful if you Insert your workflow by clicking ‘</>’ and pasting in the workflow’s code

Check Logs

  • Check http log and deploy log for n8n deployment for errors related to urls
  • Check Railway logs for url related errors

Suggestions

  • Clear browser cache. Reactivate the workflow and check the url in email sent or
  • Use a different browser to reactivate the workflow and test it
  • WEBHOOK_URL must match the callback URL in the Gmail credentials.

My Test

I tested local docker installation for n8n image and using similar workflow as your can not reproduce the problem with production url

Hi,

Thank you for your replies. I tried to deploy n8n in another container, and after importing the flow from the previous one, everything went perfectly. It’s strange, but at least I have a solution now, and I’ll keep using the new one.

Thank you and best regards.

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