Error latest version [email protected]

Error upgrading to latest version, we use mysql as the database of n8n.

Our prior version of n8n was 0.188.0.

Initializing n8n process

/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43

                nodes.forEach((node) => {

                      ^

TypeError: nodes.forEach is not a function

    at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43:23

    at Array.forEach (<anonymous>)

    at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:41:23

    at runChunked (/usr/local/lib/node_modules/n8n/dist/src/databases/utils/migrationHelpers.js:75:15)

    at processTicksAndRejections (node:internal/process/task_queues:96:5)

    at async AddNodeIds1658932910559.up (/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:40:9)

Hi @Mulen, I am sorry to hear you’re having trouble. How are you deploying n8n? Are using docker?

@MutedJam Hi.

Yes docker. Every upgrade that i did was smooth but now from 0.188.0 to 0.189.0 it throws this error in logs.

Hi @Mulen, I just gave this a go on my end by first running the below docker compose config:

version: '3.1'

services:

  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: n8n
    volumes:
      -  ./dbdata:/var/lib/mysql

  n8n:
    image: n8nio/n8n:0.188.0
    restart: unless-stopped
    ports:
      - 5678:5678
    environment:
      - DB_TYPE=mysqldb
      - DB_MYSQLDB_DATABASE=n8n
      - DB_MYSQLDB_HOST=db
      - DB_MYSQLDB_USER=root
      - DB_MYSQLDB_PASSWORD=example
      - N8N_DIAGNOSTICS_ENABLED=false
      - N8N_BASIC_AUTH_ACTIVE=false
      - N8N_USER_MANAGEMENT_DISABLED=true
    depends_on:
      - db
    volumes:
      - ./data:/home/node/.n8n

n8n started as expected. I then created a dummy workflow including at least one node. Lastly I removed all containers, changed the n8n version to 0.189.0. However, n8n would start again as expected.

So I am afraid I can’t quite see where the migration is failing for you unfortunately. Are you perhaps using an image other than n8nio/n8n:0.189.0 for your n8n container (a custom one for example)?

@mutdmour do you by any chance have an idea what might be wrong here? It seems the migration has been added in this PR of yours: N8n 4168 add node ids by mutdmour · Pull Request #3788 · n8n-io/n8n (github.com)

My docker compose file:

version: '3.1'

services:
  n8n:
    image: n8nio/n8n
    container_name: n8n
    networks: 
      techtools:
        ipv4_address: 172.19.0.7
    dns:
      - 172.19.0.9
    restart: always
    volumes:
      - ~/.n8n:/home/node/.n8n

    environment:
      DB_TYPE: $DBTYPE
      DB_MYSQLDB_DATABASE: $DB
      DB_MYSQLDB_HOST: $DBHOST
      DB_MYSQLDB_PORT: $DBPORT
      DB_MYSQLDB_USER: $DBUSER
      DB_MYSQLDB_PASSWORD: $DBPASSWORD
      N8N_BASIC_AUTH_ACTIVE: $N8NAUTH
      N8N_BASIC_AUTH_USER: $N8NUSER
      N8N_BASIC_AUTH_PASSWORD: $N8NPASS
      N8N_ENCRYPTION_KEY: $ENCRKEY
      EXECUTIONS_PROCESS: $EXECPROC
      NODE_TLS_REJECT_UNAUTHORIZED: 0
      TZ: $TIMEZONE
      N8N_DIAGNOSTICS_ENABLED: 'false'
      N8N_USER_MANAGEMENT_DISABLED: 'true'
      #N8N_USE_DEPRECATED_REQUEST_LIB: 'true'
      #N8N_LOG_LEVEL: verbose
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    #EXECUTIONS_PROCESS: main = single process / low RAM, own = multiple process / high RAM
    command: /bin/sh -c "sleep 5; n8n start"
networks:
  techtools:
    external: true
    name: techtools_network

Env Variables:

DBTYPE=mysqldb
DB=n8n
DBHOST=<IP>
DBPORT=3306
DBUSER=n8n
DBPASSWORD=<PASS>
N8NAUTH=true
N8NUSER=n8n
N8NPASS=<PASS>
TIMEZONE=Europe/Athens
ENCRKEY=<KEY>
EXECPROC=main

Hm, this is looking good to me. Do you by any chance have a workflow without any nodes that n8n would try to migrate when hitting this error?

No, all my workflows have nodes. :confused:

So in that case I’d say let’s wait if @mutdmour has any more insights to share on what this migration does.

If you urgently need to upgrade you can consider exporting your credentials and workflows from your 0.188.0 n8n instance using the CLI, stop your old 0.188.0 instance and start [email protected] using a fresh database, so no migration needs to happen. You can then import your workflows and credentials again.

Thanks.

I’ll wait, maybe @mutdmour has a solution. I can’t risk doing a clean install.

Hey @Mulen,

This is something we are aware of and a fix is being worked on, Could you add your details onto this Github Issue?

2 Likes

Fixed with newest version [email protected]

Thank you.

2 Likes