Persistent "Failed to resolve host" Error with Telegram Trigger on Hetzner Cloud

Hi everyone,

I’m running into a very persistent issue with the n8n Telegram Trigger that I have been unable to solve after extensive troubleshooting.

My Setup:

  • n8n running in a Docker container.
  • Hosted on a Hetzner Cloud server (Ubuntu).
  • Using a Caddy reverse proxy for SSL.

The Problem: When I try to activate the Telegram Trigger node, I immediately get the following error: Bad Request: bad webhook: Failed to resolve host: Temporary failure in name resolution

The Paradox / What I’ve Already Tried: The strange part is that the container’s networking seems to be working correctly. The problem appears to be specific to the n8n process itself, not the underlying container OS.

Here is what has already been verified and attempted:

  • Correct Docker Installation: The initial Docker installation was a Snap package. This has been completely removed and Docker has been reinstalled from the official apt repository.
  • General DNS Works: From inside the n8n container, ping google.com works perfectly.
  • Specific Domain DNS Works: From inside the n8n container, ping my-webhook-domain.duckdns.org also resolves the correct IP and works perfectly.
  • Hairpin NAT / Loopback: We tried to mitigate any loopback issues by adding an extra_hosts entry to the docker-compose.yaml to map the domain to host-gateway. This did not solve the issue.
  • Forced DNS: We tried forcing the n8n service to use public DNS servers (8.8.8.8 and 1.1.1.1) directly in the docker-compose.yaml. This did not solve the issue.
  • n8n Environment Variables: We have double-checked and simplified the environment variables, using the correct N8N_WEBHOOK_URL.
  • Hetzner Firewall: I have confirmed that there is no active Hetzner Cloud Firewall applied to this server.
  • Bypassed Proxy: As a final diagnostic test, we tried bypassing Caddy entirely by exposing port 5678 and setting the webhook URL to http://<SERVER_IP>:5678/. This still resulted in the exact same Failed to resolve host error.

Despite all of this, the name resolution seems to fail only for the n8n process when the trigger is activated.

Does anyone have an idea what could be causing this at a deeper level within the Hetzner/Ubuntu/Docker environment? I’m out of ideas.

Here is my docker-compose.yaml:

services:
  n8n:
    image: n8nio/n8n
    restart: unless-stopped
    environment:
      - N8N_PATH=/n8n
      - N8N_EDITOR_BASE_URL=...
      - N8N_PUBLIC_API_BASE_URL=...
      - WEBHOOK_URL=...
      - N8N_PROTOCOL=...
      - N8N_HOST=...
    volumes:
      - ~/.n8n:/home/node/.n8n
      - /data:/data
    extra_hosts:
      - "...duckdns.org:host-gateway"
    dns:
      - 8.8.8.8
      - 1.1.1.1

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
      
volumes:
  caddy_data:
  caddy_config:

My Caddyfile:

...duckdns.org {
    handle /n8n* {
        uri strip_prefix /n8n
        reverse_proxy n8n:5678
    }

    handle {
        respond "404 not found" 404
    }

    header {
        X-Content-Type-Options nosniff
    }
}
1 Like

I have the same issue, did you manage to find solution? I’m also running n8n on a Hetzner cloud server using coolify

I think the issue is related to the new update. I’m looking for a solution, and it seems that multiple topics are talking about the same situation:

When you try to send a message to a chat ID, everything works fine. But the trigger nodes are not working. I noticed it’s the same situation with Slack.

Docker-compose and Caddyfile are verified, and I’ve been looking for a solution for hours now.

Probably we should wait for an update or downgrade the n8n version.

I am having the same issue.

As I understand something goes wrong when the webhook gets added to the bot.

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=https://n8n.<MY_SUBDOMAIN>.duckdns.org/webhook/<WEBHOOD_ID>/webhook"

{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: Failed to resolve host: Temporary failure in name resolution"}

I am able to reproduce the error even by removing all the webhook-related details from the URL as well, keeping only my DNS:

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=n8n.<MY_SUBDOMAIN>.duckdns.org"

{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: Failed to resolve host: Temporary failure in name resolution"}

If I put a wrong subdomain, I get a different error:

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=n8n.<WRONG_SUBDOMAIN>.duckdns.org"

{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: Failed to resolve host: Name or service not known"}

So Telegram is able to find my host, but then something goes wrong.

I wonder if my issue is related to the DuckDNS domain names. Does anyone get similar issues without using DuckDNS?

Other tests.

Running with IP only seem to be accepted:

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=<IPv4>"
curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=https://<IPv4>"
{"ok":true,"result":true,"description":"Webhook was set"}⏎

But I get another error when adding the n8n port.

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=https://<IPv4>:5478"
{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: Webhook can be set up only on ports 80, 88, 443 or 8443"}⏎

Actually, taking another step.
Using duckdns.org as url fails:

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=duckdns.org"
{"ok":false,"error_code":400,"description":"Bad Request: bad webhook: Failed to resolve host: Temporary failure in name resolution"}⏎

But using google.com works:

curl -X POST "https://api.telegram.org/bot<MY_KEY>/setWebhook" -d "url=google.com"
{"ok":true,"result":true,"description":"Webhook was set"}⏎

So I wonder if it’s an issue with Telegram blocking duckdns?

I used https://www.dynu.com to create a new free DNS, Telegram worked with it.

<my_subdomain>.ddnsfree.com

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