Resetting encryptionKey after upgrade

Hey, everybody.

After upgrading to version 1, the instance replaced encryptionKey by itself for some reason.

I think it’s clear that no workflows work, but that’s not the problem anymore - I can’t export them, I get an error:

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

Before n8n the /opt/n8n folder was thrown in, no problems with permissions during the upgrade, but nevertheless the key was replaced and unfortunately I don’t have a backup of the previous key.

Can you tell me how I can restore credentials quickly?

Information on your n8n setup

  • n8n version: 1.4.1
  • Database: PostgreSQL
  • n8n EXECUTIONS_PROCESS: main):
  • Running n8n via Docker:
  • Operating system: Ubuntu 22.04

Hi @brewoutlay ,

If you do not have the encryption key you can not restore the credentials. You will need to enter them all again.
Personally, I always set an encryption key in the env variables to make sure it keeps the same key at all times.
It could however be that the key is still there just in another location. But that depends on your setup and did you upgrade to a pre-v1 to this 1.4.1 you list here? or were you already on v1+?

No, I was on version 0.236 (I think), and immediately upgraded to 1.4.1

That’s a fiasco, how could you even allow the key to spontaneously change when upgrading?!

It didn’t change. the Folder changed with v1. So you are lucky you should be able to retrieve it. there were some topics on the forum about it. So have a look around you will be able to find it.
I do not know out of the top of my head how to help you so have a look on the forum or wait for someone to tell you where to find it :wink:

Assuming you have persistant storage configured properly btw.

The folder is hosted, I took the encryption code from it and pasted it into .env, which also didn’t help.

You have the original encryption key or the new one?
if you have the original you are good, you just need to show us what you are doing and we can help fix it.

No, it’s a key generated by the new installation.
this is fucked up, I just have no other reaction to what happened.

I can’t even go into workflows, to replace credentials, because they don’t even open.

CleanShot 2023-09-01 at 11.52.02

The workflows do not open?
what is the message then?

CleanShot 2023-09-01 at 11.56.45

This is also the message when you open a workflow?
That is pretty weird.

I don’t care about them.

what I care about right now is restoring Credentials.

I have backups from workflows, but I have large and complex processes, going into each node to change credentials is almost like doing it all over again.

Hey @brewoutlay,

The n8n application will only create an encryption key if an existing one can’t be found. The key itself will normally be in the .n8n folder that would be mapped to a docker volume or bind, If however this was not correctly configured the key would only exist for as long as the instance is on the same version.

If the original encrypted key is lost there is no way to recover the credentials as they are encrypted with a random key generated just for your instance so you would need to create the credential again.

1 Like