Credentials could not be decrypted "EncryptionKey"

Describe the issue/error/question

Hello,
We have issue with with our workflow using n8n docker deployment, we have wehbook trigger when using it in test mode all is good, but when switching to production we have the following error in the execution list “Credentials Could not be decrypted”.

  • We have already checked that the “.n8n” folder is persisted/Mounted in our docker deployment.
  • We have set the environment variable " N8N_ENCRYPTION_KEY" to a random string and recreate all our credential but the same error persist.

What is the error message (if any)?

Credentials could not be decrypted. The likely reason is that a different "encryptionKey" was used to encrypt the data.

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.168.2
  • Database you’re using (default: SQLite): Postgress
  • Running n8n with the execution process [own(default), main]: Main
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Dokcer

Hi @karim_akrour, welcome to the community!

I’m sorry to hear you’re having trouble. This sounds a bit like the N8N_ENCRYPTION_KEY variable could have been set after the first n8n launch, meaning n8n would have generated its own random key rather than using the one from your variable.

Seeing your credentials are working on your test instance, could you simply export them in their decrypted form using the CLI (using n8n export:credentials --all --decrypted --output=backups/decrypted.json as described here)? You should then be able to run the corresponding import command regardless of the actual encryption key value.

hello thanks for your reactivity,
We got the same error when executing the command using the CLI.

Error message : Error exporting credentials. See log messages for details.
No encryption key got found to decrypt the credentials!

we have removed the old install,reinstall the via docker-compose, import the workflow and recreate the credential but the same problem persist, please find below the .env file conf

POSTGRES_USER=xxx
POSTGRES_PASSWORD=xxx
POSTGRES_DB=xxx
POSTGRES_NON_ROOT_USER=xxx
POSTGRES_NON_ROOT_PASSWORD=xxx
N8N_BASIC_AUTH_USER=xxx
N8N_BASIC_AUTH_PASSWORD=xxx
N8N_ENCRYPTION_KEY=eNNeYdqfPIFj+Nvgd6o15daWdMShAPST
DOMAIN_NAME=xxxxx
SUBDOMAIN=xxx

Hi @karim_akrour, did you find a solution? we are facing the same issue today

Hi @DCP, I am sorry you’re having trouble.

As suggested before this would typically mean that a new encryption key has been generated. This happens for example if you run n8n via docker without persisting data.

You would have to either re-create your credentials in such cases or load a backup via the CLI if available.

@MutedJam thanks for your reply! We are up and running again :+1:

1 Like

I am so glad to hear that, and sorry for the trouble.

You might want to backup the config file inside your ~\.n8n directory which would include the encryption key used by n8n just in case you run into any future trouble.

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