The DNS server returned an error, perhaps the server is offline

Hello

I installed n8n on a Vultr Server following the installing n8n on Digital Ocean thread.

When I am trying to get something via any API call node. It shows The DNS server returned an error, perhaps the server is offline error

Error code

EAI_AGAIN

Full message

getaddrinfo EAI_AGAIN api.airtable.com

I have another one working on Digital Ocean without any problem.
I am not sure if there is any difference between Vultr and DO.

However, the Vultr 1GB is on the latest version(1.60.) . The Digital Ocean 2GB (1.45.1)
This warning kind of appears ramdly. Sometimes it works, sometimes it doesn’t. Any idea what I can do to resolve the issue? Or if it is a updated version bug?
Thanks

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:

hello @Blueli

That doesn’t seem to be an issue with n8n, check that your Vultr is configured properly and can perform DNS requests (you can check with curl that sites are working. E.g. curl google.com)

Hello
The only thing I have edited after installation are these two files. Are there any noticeable misconfigurations?

Thanks

  GNU nano 6.2                                                  .env                                                           
# Replace <directory-path> with the path where you created folders earlier
DATA_FOLDER=/root/n8n-docker-caddy

# The top level domain to serve from, this should be the same as the subdomain you created above
DOMAIN_NAME=mydomain.com

# The subdomain to serve from
SUBDOMAIN=myapp

# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.example.com

# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=Asia/Hong_Kong

# The email address to use for the SSL certificate creation
[email protected]

export N8N_LOG_LEVEL=debug

export N8N_LOG_OUTPUT=console,file

export N8N_LOG_FILE_LOCATION=/home/jim/n8n/logs/n8n.log

export N8N_LOG_FILE_MAXSIZE=50

export N8N_LOG_FILE_MAXCOUNT=20

export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true

export EXECUTIONS_DATA_SAVE_ON_ERROR=all

export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all

export NODE_OPTIONS=--max-old-space-size=1536
services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - 5678:5678
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - n8n_data:/home/node/.n8n
      - ${DATA_FOLDER}/local_files:/files

volumes:
  caddy_data:
    external: true
  n8n_data:
    external: true

We’ve had issues with this exact domain in the past, and it was an issue of the domain resolving to an IPv6 address, but not actually responding to that address.

Although we don’t recommend it, you could try configuring n8n to prefer IPv4 over IPv6 by setting the env variable NODEJS_PREFER_IPV4 to true.

Our recommended solution would be to use a different DNS upstream, but I don’t know if your setups allows configuring DNS servers.

Hello

I dont understand why Two n8n are installed on both my Digital Ocean and Vultr Server with the same setting, Same workflow, one works on Digital Ocean. But not on Vultr.

I saw one of your old threads where you mentioned the solution. Why is it not recommended to have NODEJS_PREFER_IPV4 to true .
And Would you mind elaborating more about “use a different DNS upstream”? As my server knowledge is very limited… Thanks a lot!

This is happening because localhost is resolving to ::1 (IP v6), and n8n isn’t listening to that IP because N8N_LISTEN_ADDRESS defaults to 0.0.0.0 (all IP v4).
Please try setting N8N_LISTEN_ADDRESS to ::.

Another option would be to force n8n to use IPv4 by setting NODEJS_PREFER_IPV4 to true.

They probably mean setting a custom DNS server for the docker container in Vultr. But forcing ipv4 would be an alternative as well.

If Digital Ocean works fine all the time but Vultr doesn’t with the same settings this points to an issue with Vultr.

Hope this helps!