n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
45.7k stars 6.36k forks source link

Tunnel webhooks get stuck (504 Gateway Time-out) #5939

Open umanamente opened 1 year ago

umanamente commented 1 year ago

I am using n8n --tunnel on my local machine.
When I start it, it outputs "Tunnel URL:" without any problems, but any webhooks sent to this URL get stuck.
I created a test webhook with a GET request, but when I open this link in the browser, it endlessly loads. Then it outputs 504 Gateway Time-out, nginx/1.15.12 The webhook also doesn't reach my n8n workflow. Webhooks are working on my production machine (without --tunnel), but I need to test the package on my local machine. I tried to set a different webhook subdomain via N8N_TUNNEL_SUBDOMAIN, no luck.

To Reproduce

  1. n8n start --tunnel
  2. Create simple GET webhook trigger
  3. Open webhook URL in browser
  4. Page endlessly loads

Expected behavior

Webhook reach my n8n node

Environment (please complete the following information):

Joffcom commented 1 year ago

Hey @umanamente

How are you running n8n is it from source, docker or npm? I would assume npm but it is worth double checking, normally I would start with making sure you are on the recommended node version (16) but I am not sure that would help.

It looks like maybe the tunnel url is not being registered correctly, if you remove the tunnel subdomain option and start n8n with the tunnel option again what does the url look like for the webhook node?

umanamente commented 1 year ago

@Joffcom I'm running it from npm. I specified my node version in the description.

I tried with both "tunnel subdomain" option and without it, same result. I suppose that the server is down. I'm running n8n without "tunnel subdomain", and my current latest webhook URL provided is this: https://pnpj3ulcjcccieuvov4nktuv.hooks.n8n.cloud/webhook-test/9e6bc9b6-2ee0-4608-a14f-818ecb893e3b/webhook

By the way is it possible to set up my own tunnel server?

Joffcom commented 1 year ago

Hey @umanamente,

You might be able to set up your own tunnel server but it wouldn't be the same as the n8n tunnel server, You would need to fire up a client locally using something like ngrok (or another tunnel service) then update the webhook_url to use that tunnel address.

I do remember an issue from a while back where created tunnels on Windows wouldn't allow connections but running n8n in WSL or docker on Windows with the tunnel option all was good. Let me check to see if we have resolved that issue.

Joffcom commented 1 year ago

Hey @umanamente,

It looks like the issue with the tunnel not working on windows when using npm has not been resolved, I have nudged it though so we can prioritise it again.

Our internal ticket for tracking this one is N8N-5948

RodrigoCamposD commented 1 year ago

Same here (npm install n8n -g) with simple workflow with just a GET webhook, tried to reinstall, update, delete .n8n folder, production url, load another simple template. Locally everything is ok (http://localhost:5678/) but not reaching the given tunnel URL. No error logs.

Expected: {"message":"Workflow was started"} Response: 504 Gateway Time-out nginx/1.15.12

OS: Windows 10 Pro 22H2 (updated) Node: v18.16.0 n8n: 0.227.1

Also tried npm install -g n8n@next (version 0.228.2) and npm update -g. Just another two global npm packages: nodemon and ndb.

Note: At some point doing tests, the webhook URL in the worflow now always is set to http://localhost:5678/... no more the tunnel URL given in the start log in console. I have to change manually to test but no success again, 504.

Joffcom commented 1 year ago

Hey @RodrigoCamposD,

Anyone using Windows will see this, I would recommend using Docker if you want to use the tunnel option for testing if you are running n8n in a production environment or don't want the url to change using your own domain would be the best option to take for that.

RodrigoCamposD commented 1 year ago

Hi @Joffcom already doing that, n8n with Docker working beautifully. Really thanks!

ivanmirandaf commented 4 months ago

Fala pessoal, estou com o mesmo problema aqui. O meu n8n está no modo fila rodando no docker swarm e estou usando o traefik como proxy reverso.

OS: Ubuntu 22.04.4 Docker: 26.1.3 N8N: 1.40.0 Traefik: 3.0.0

n8n queue mode tunnel

Joffcom commented 4 months ago

Hey @ivanmirandaf,

If you are using traefik and queue mode I would not use the n8n tunnel option as it is not designed for production environments, Intsead you would be better off correctly routing your DNS record to your Traefik instance and setting the WEBHOOK_URL environment variable.

ivanmirandaf commented 4 months ago

Eai @Joffcom, não é um ambiente de produção, gerei os certificados via mkcert e configurei o traefik para usar esses certificados.