N8n worker get error N8N_ENCRYPTION_KEY var after update new version

Describe the problem/error/question

After update new version i got this error “Error: Missing encryption key. Worker started without the required” so my docker container always restarting and i put N8N_ENCRYPTION_KEY env on docker-compose.yml but still cant solve the error.

What is the error message (if any)?

After update from Version 1.24.1
image

Information on your n8n setup

  • **n8n version: 1.25.1
  • **Database (default: SQLite): Postgres
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • **Operating system: Ubuntu 22.04

Hey @tridi,

If you downgrade back to 1.24.1 does it start working again?

hi @Jon its happen to another worker so i log into main n8n docker container and copy the encrypt key from config file to my docker-compose.yml env and solve the error

So i guess its better to define N8N_ENCRYPTION_KEY from beginning coz i follow this config n8n/docker/compose/withPostgresAndWorker/docker-compose.yml at master · n8n-io/n8n · GitHub

Btw there is another suggest env for postgres with worker i missing? heres mines:

  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}
    - EXECUTIONS_MODE=queue
    - N8N_ENCRYPTION_KEY=
    - QUEUE_BULL_REDIS_HOST=redis
    - QUEUE_HEALTH_CHECK_ACTIVE=true
    - N8N_EDITOR_BASE_URL=
    - NODE_ENV=production
    - N8N_PUSH_BACKEND=sse
    - N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true
    - WEBHOOK_URL=
    - N8N_ENDPOINT_WEBHOOK=rm
    - N8N_ENDPOINT_WEBHOOK_TEST=rm-tes
    - N8N_GRACEFUL_SHUTDOWN_TIMEOUT=30
    - GENERIC_TIMEZONE=Asia/Jakarta
    - N8N_PROTOCOL=https
    - N8N_HOST=
    - N8N_EMAIL_MODE=smtp
    - N8N_SMTP_HOST=
    - N8N_SMTP_PORT=465
    - N8N_SMTP_USER=
    - N8N_SMTP_PASS=
    - N8N_SMTP_SENDER=
    - N8N_SMTP_SSL=true
  n8n:
    <<: *shared
    image: n8nio/n8n
    command: /bin/sh -c "n8n start"
    # ports:
    #  - 5678:5678

  n8n-worker:
    <<: *shared
    image: n8nio/n8n
    command: /bin/sh -c "sleep 5; n8n worker"
    depends_on:
      - n8n
1 Like

Happened too! I have to re-enter the credentials

Hey @tridi,

In the repo you linked it looks like it would do the job, It doesn’t include the encryption key var as it shares the same data folder between the worker and the main instance so it will use the same key.

If you do see the credential issue it is always worth checking that the value of the config file under /home/node/.n8n/ has the key you are setting.

hi jon yes there is the key on that path but this happen when i pull new version and my another worker like not link to that config… i will try on my another instance later for update and see if this issue happen again

1 Like

I had the same after updating from 1.22.6 to 1.25.2, the config file is present in the shared directory but still got the error from the worker there was no encryption key found. after setting it in the docker-compose.yml all was running again.

Any idea how to look in to this further to know what was going wrong? the files are all shared across the containers as in the example compose file earlier mention in this topic.

Hey @Oidt,

Welcome to the community :tada:

The encryption key needs to be set using the Env option, This is something that was often missed so we moved to enforce this as part of some other changes recently. I suspect part of it being missed was the docker examples being used. I will make sure we update the docker examples this week.

Thanks for the reply! We really love the product, it is amazing! keep up the good work.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.