401 - "Authorization is required!"

Describe the issue/error/question

Hello,
I have two workflow that have Webhooks Trigger with basic auth, both Webhooks are in production mode.
The logic is that after the execution of the first Webhooks he make http request to the Webhooks of the second workflow but I’m getting 401 error when trying to reach the second Webhooks.
I tried the same http request without connecting it to the workflow and it work normaly, I’m using basic auth with simple password.

What is the error message (if any)?

401 - “Authorization is required!”

Please share the workflow

Information on your n8n setup

I’m using the latest docker image.

Note : I have the same workflow working in another deployement

Hey @karim_akrour1,

Welcome to the community :tada:

Is your n8n instance using Basic auth or the new user management feature?

Hey @Jon

For Webhooks we are using Basic auth, I don’t have much information about the new user management feature.

Bellow our docker compose file config

services:
  redis:
    image: redis:latest
    restart: always
    ports:
      - 127.0.0.1:6378:6379
    volumes:
      - redis_data:/var/lib/redis
      #- redis.conf:/usr/local/etc/redis/redis.conf

  postgres:
    image: postgres:14.2-alpine3.15
    restart: always
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
      - POSTGRES_NON_ROOT_USER
      - POSTGRES_NON_ROOT_PASSWORD
    ports:
      - 127.0.0.1:5432:5432
    volumes:
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
      - postgres_data:/var/lib/postgresql/data

  n8n_server:
    image: n8nio/n8n:latest
    restart: always
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - EXECUTIONS_MODE=queue
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379
      - WEBHOOK_TUNNEL_URL=${WEBHOOK_TUNNEL_URL}
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - N8N_EMAIL_MODE=${N8N_EMAIL_MODE}
      - N8N_SMTP_HOST=${N8N_SMTP_HOST}
      - N8N_SMTP_PORT=${N8N_SMTP_PORT}
      - N8N_SMTP_USER=${N8N_SMTP_USER}
      - N8N_SMTP_PASS=${N8N_SMTP_PASS}
      - N8N_SMTP_SENDER=${N8N_SMTP_SENDER}
      - N8N_SMTP_SSL=false
    ports:
      - 0.0.0.0:5679:5678
    links:
      - postgres
      - redis
    volumes:
      - n8n_data:/home/node/.n8n
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    command: /bin/sh -c "sleep 5; n8n start --tunnel"

  n8n_worker:
    container_name: n8n_worker
    image: n8nio/n8n:latest
    command: n8n worker
    restart: always
    environment:
      # ----- redis ----- #
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379
      # ----- postgres ----- #
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
    volumes:
      - n8n_data:/home/node/.n8n
    ports:
      - 127.0.0.1:5678:5678
    links :
      - n8n_server

volumes:
  redis_data:
    driver: local
  postgres_data:
    driver: local
  n8n_data:
    driver: local

Hey @karim_akrour1,

Which node is throwing the error? Is it “Network Worklow 1”? Which instance are you directing the webhook traffic to as well is it the main instance? Normally if you are using scaling mode you would also have an instance running that takes the webhooks but I can’t see that in your compose file… not that it shoudl matter for this one.

If you are getting a 401 back it is going to point to an authentication issue so it is just going to be a case of working out where it is.

Maybe as a quick test what happens if you just try to run the node that is failing and remove the webhook call from the start of it?

Hey @jon

Yes its the node “Network Worklow 1”, if just test the same request with the same credentials duplicated node “Network Worklow 2” it work normaly