Unable to Update to Latest Version with Docker (Currently on 0.51.0)

I’ve been unable to update past version 0.51.0. I originally used the following guide to setup n8n with letsencrypt:

This is my docker-compose.yml file:

version: "3"

services:
  traefik:
    image: "traefik"
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "4443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_TUNNEL_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - VUE_APP_URL_BASE_API=https://${SUBDOMAIN}.${DOMAIN_NAME}/
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${DATA_FOLDER}/.n8n:/root/.n8n

If I change the line:

    image: n8nio/n8n

to:

    image: n8nio/n8n:0:51:0

… it works fine. But anything past that throws the error below.

Did something change in version 0.52.0 with regards to permissions or something? This is the error log I get when I update to the latest version 0.70.0 or other versions such as 0.52.0:

(node:8) UnhandledPromiseRejectionWarning: Error: There was an error: EACCES: permission denied, open '/home/node/.n8n/config'
    at Object.error (/usr/local/lib/node_modules/n8n/node_modules/@oclif/errors/lib/index.js:22:17)
    at Start.error (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:60:23)
    at /usr/local/lib/node_modules/n8n/dist/commands/start.js:114:22
(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8) UnhandledPromiseRejectionWarning: Error: SQLITE_CANTOPEN: unable to open database file
(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

If anyone could guide me on how I could fix this issue, I would greatly appreciate it. Thanks!

Welcome to the community @marc!

We changed at some point the dockerfile to use the user node instead of root. It got however changed in a way that should not break anything for anybody. What you can however try is to change the last line from:

- ${DATA_FOLDER}/.n8n:/root/.n8n

to

- ${DATA_FOLDER}/.n8n:/home/node/.n8n

Additionally, try to change the access rights of your local .n8n folder because for some reason does it seem like n8n can not access it.

Thanks @jan! Managed to get it working. For some reason there were no permissions set on the config and database.sqlite files. Strange that it was still working… perhaps because it was running as root previously on version 0.51.0.

Not sure what permissions it requires, but set it to 755 and it’s working now.

/volume3/docker/n8n$ ls -la data/.n8n/
total 52
drwxr-xr-x+ 2 1000 root  4096 Feb 21 11:48 .
drwxr-xr-x+ 4 root root  4096 Feb 20 16:12 ..
----------  1 1000 root    56 Feb 20 16:12 config
----------  1 1000 root 40960 Feb 21 11:48 database.sqlite

/volume3/docker/n8n$ cd data/.n8n

/volume3/docker/n8n/data/.n8n/$ chmod 755 config

/volume3/docker/n8n/data/.n8n/$ chmod 755 database.sqlite

/volume3/docker/n8n/data/.n8n/$ cd ../..

/volume3/docker/n8n$ ls -la data/.n8n/
total 56
drwxr-xr-x+ 2 1000 root  4096 Jun 17 12:05 .
drwxr-xr-x+ 4 root root  4096 Feb 20 16:12 ..
-rwxr-xr-x  1 1000 root    56 Feb 20 16:12 config
-rwxr-xr-x  1 1000 root 45056 Jun 17 12:05 database.sqlite

I also updated the path as you mentioned to point to /home/node/.n8n. The docs still refer to the old path. Perhaps it’s worth updating the docs to help future users if the path has now changed?