408 Request Timeout when trying to use the API with an instance that is using tunnelling

Hi everyone!

just wondering if I could get some help with trying to use the API.

I’m trying to make a call to a n8n instance I have running using curl. when calling to the local host the command executes perfectly and returns as expected (as shown below). However, when I try to make this same call to the tunnel URL of this instance I receive the error “408 request timeout”.

I got the commands from the API playground and they execute fine in that environment however if I attempt to make this call in the terminal and it times out then I am unable to go back to the API playground page as it shows “408 Request Timeout” on the webpage but only after I make a failed request in the terminal.

I’ve even tried turning off the firewall just in case that was blocking it but no luck, any help anyone can give me with this would be greatly appreciated quite stuck at the moment!

Below are the verbose curl commands (the first is the call to the local host and the second is to the tunnel URL):

C:\Users\kyles>curl -v -X "GET" "http://localhost:5678/api/v1/users?limit=100&includeRole=true"  -H "accept: application/json"  -H "X-N8N-API-KEY: n8n_api_MY_API_KEY"
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying [::1]:5678...
* Connected to localhost (::1) port 5678
> GET /api/v1/users?limit=100&includeRole=true HTTP/1.1
> Host: localhost:5678
> User-Agent: curl/8.4.0
> accept: application/json
> X-N8N-API-KEY: n8n_api_MY_API_KEY
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Content-Length: 390
< ETag: W/"186-gyJqmFLa2ZcOgWUF6GtJ2Gh4u6k"
< Vary: Accept-Encoding
< Date: Tue, 28 Nov 2023 11:30:22 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{"data":[DATA REDACTED]}

C:\Users\kyles>curl -v -X "GET" "https://my_tunnel_URL.hooks.n8n.cloud/api/v1/users?limit=100&includeRole=true"  -H "accept: application/json" -H "X-N8N-API-KEY: n8n_api_MY_API_KEY"
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying Tunnel.IP.Address:443...
* Connected to my_tunnel_URL.hooks.n8n.cloud (Tunnel.IP.Address) port 443
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* using HTTP/1.1
> GET /api/v1/users?limit=100&includeRole=true HTTP/1.1
> Host: my_tunnel_URL.hooks.n8n.cloud
> User-Agent: curl/8.4.0
> accept: application/json
> X-N8N-API-KEY: n8n_api_MY_API_KEY
>
< HTTP/1.1 408 Request Timeout
< Server: nginx/1.15.12
< Date: Tue, 28 Nov 2023 11:20:11 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
<
* Connection #0 to host my_tunnel_URL.hooks.n8n.cloud left intact

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @kyle_swire-thompson,

Welcome to the community :raised_hands:

The tunnel is only designed for testing and can result in issues sometimes, There is also a known issue where the tunnel doesn’t work properly on Windows machines when running n8n from npm which could be what you are seeing.

Are you using npm or docker?

Hi Jon,

thanks for the fast response, I’m using docker.

Here is the terminal for when I initialized the instance:

C:\Users\kyles>docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n  docker.n8n.io/n8nio/n8n start --tunnel
Initializing n8n process
n8n ready on 0.0.0.0, port 5678

Waiting for tunnel ...
Tunnel URL: https://tunnel_url.hooks.n8n.cloud/

IMPORTANT! Do not share with anybody as it would give people access to your n8n instance!
Version: 1.17.1
 ================================
   Start Active Workflows:
 ================================
   - "Workflow 1" (ID: xxxxxxx)
     => Started

Editor is now accessible via:
http://localhost:5678/

Press "o" to open in Browser.

Hey @kyle_swire-thompson,

So I suspect it is the same issue that is seen with npm on windows and something is blocking the connection, When I was looking before I couldn’t find anything obvious in the windows settings and even took the approach of disabling the windows firewall fully.

The best option here would be to move away from the tunnel if you are planning to use n8n for more than just testing and if you are testing something like a cloudflare tunnel would work or ngrok.

1 Like

Hey Jon,

yeah, that’s along the lines of what I was thinking. Got it working using ngrok like you suggested, thanks you your help!

1 Like

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