How to connect N8N to Odoo in the same server

Hi guys,

I am using the latest docker N8N on Debian, and I cannot set up the connection of Odoo in N8N. I am self hosting N8N and Odoo in the same server.

I have tried to set up the Odoo’s connection from an external N8N, and it seems working, but it does not if both N8n and Odoo in the same place. Any suggestion? Thank you.

This is the error I got:

Couldn’t connect with these settings
Settings are not valid: AxiosError: timeout of 300000ms exceeded.

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:

hi @semighoti

Can you share how you have both instances set up, is it via docker? How are you configuring both services?

thanks!

Hi @gualter,

Thank you for spending time reviewing my question.

Odoo docker set up

services:
  web:
    image: odoo:latest
    ports:
      - "8069:8069"
    container_name: odoo
    volumes:
      - data-odoo:/var/lib/odoo
      - path/to/odoo/config:/etc/odoo
      - path/to/odoo/addons:/mnt/extra-addons
    environment:
      - HOST=postgres #the container_name of the database is postgres
      - USER=odoo
      - PASSWORD=PASSWORD
      - PORT=5432
    restart: unless-stopped
    networks:
      - n8nnw
volumes:
  data-odoo:

networks:
  n8nnw:
    name: n8nnw

This is N8N docker-compose set up

services:
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    container_name: n8n
    ports:
      - 5678:5678
    environment:
      - GENERIC_TIMEZONE=
      - N8N_BASIC_AUTH_ACTIVE=true
      - ...
    volumes:
      - ./n8n_data:/home/node/.n8n
    networks:
      - n8nnw

networks:
  n8nnw:
    name: n8nnw
  

Both N8N and Odoo works perfectly, but when I try to connect N8N to Odoo, I get this error

Hope this makes my question clear.

Thanks! Are they both on the same host? Definitely feels like some network constraint between both containers.

@gualter Yes, they are both on the same host. I can connect N8N to the same-host postges, but cannot connect to the Odoo. I have search Google for it, but I have found no solution so far.

For connecting to local container Postgres, all I need to put in the Host section is the container name, Postgres, to connect to it in stead of an URL. Should Odoo have that option too? In the SiteURL section in Odoo node, it would be great if we have the local host option input as in Postgres node.

They are 2 different nodes, I took a look at our Odoo documentation and we seem to refer to: External API — Odoo 17.0 documentation

I’m not familiar with Odoo myself, but you mentioned you were able to connect successfully from an external n8n. How did you connect to it?

I think this is the case where our node only supports connections from the outside, not on the same host (I could be wrong here though)

When I was on the external N8N, I used http://oddo.mydomain.com, username + password to connected to Odoo, all worked normally. But in the local N8N, I use the same credentials, but it does not connect. I guess that the URL does not work on the local host. I have tried to put the Odoo container_name into the URL section, but no help.

I guess that the URL does not work on the local host

Most likely, yes. Are you able to use a public URL instead of a local one? Can you expose the Odoo instance so you use a public URL?

Not really. I prefer to keep both locally. I use Tailscale to access Odoo and N8N remotely, and it is going pretty well. It would be more work potentially if I exposed both online.