Provider routines::bad decrypt after upgrading to 1.18.0

My issue sounds similar to Bad n8n credentials decrypt when running cron but I can’t access ANY credentials over the web UI after the upgrade from pre 1.x version.
As soon as I click edit on any credentials I get this error except if I create new credentials.
I didn’t see anything in the migration guide related to encryption/credentials.

I do have a custom Dockerfile not sure if this is related somehow.

FROM n8nio/n8n:latest

USER root
RUN apk --update add curl

I do this because I have some legacy workflows that need curl with binary data upload and I couldn’t use the existing http request nodes.

My docker-compose looks like this

    image: n8n-curl
    restart: always
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - NODE_ENV=production
      - N8N_PORT=5678
      - WEBHOOK_URL=
      - GENERIC_TIMEZONE=Europe/Vienna
      - 15043:5678
      - postgres
      - /opt/docker/n8n/n8n:/home/node/.n8n
      - /opt/docker/n8n/data:/home/node/data

I could fix this issue by defining the N8N_ENCRYPTION_KEY ENV variable to the same content as was in the .n8n/config file.

my config file looks like this

        "encryptionKey": "asdf'

did something change here?

hey had the same issue when upgrading to 1.19.4. The mentioned fix worked for me as well

Hey @crisl,

I wonder if changing your docker image to use the node user would fix this as we changed the user in v1 to node so by swapping the user to root it might be trying to use /root/.n8n for the data internally and not the preferred /home/node/.n8n.

Try adding the below to the end of your dockerfile.

USER node

Thank you.
I discovered a discrepancy in the key between what was specified in the environment variable and what was in the config file.
I’ve actually just removed the config file, and everything appears to be working fine again.
Guessing after 1.12.2 something was changed and the config file was being used instead of the environment variable, even though the environment variable was already specified.

1 Like

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