# Credentials error

**URL:** <https://community.n8n.io/t/credentials-error/181>\
**Category:** Questions\
**Created:** [October 13, 2019, 12:33pm UTC](https://community.n8n.io/t/credentials-error/181 "2019-10-13T12:33:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![calpa](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/calpa/32/132_2.png) [@calpa](https://community.n8n.io/u/calpa)\
**Post date:** [October 13, 2019, 12:33pm UTC](https://community.n8n.io/t/credentials-error/181/1 "2019-10-13T12:33:51Z")

</div>

I got this error after I restart my machine, and I also cannot open my credentials in stored credentials…

```auto
The following error occurred on workflow activation:
Credentials could not be decrypted. The reason is that probably a different "encryptionKey" got used to encrypt the data than now to decrypt it.

```

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 13, 2019, 12:39pm UTC](https://community.n8n.io/t/credentials-error/181/2 "2019-10-13T12:39:08Z")

</div>

All credentials are encrypted for security reasons before they are saved to the database. That encryption key gets saved in the subfolder “.n8n” in the user folder.

If you delete that folder or you start n8n with docker without mounting it to persist it, you will not be able to decrypt the data like the error message mentions.

---

<div class="post-metadata">

**Author:** ![calpa](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/calpa/32/132_2.png) [@calpa](https://community.n8n.io/u/calpa)\
**Post date:** [October 13, 2019, 12:54pm UTC](https://community.n8n.io/t/credentials-error/181/3 "2019-10-13T12:54:23Z")

</div>

I am using Heroku Free tier, which means that the whole system will be reseted after 30minutes. Is there any solution to backup the `.n8n` folder?

I had followed the tutorial to setup a remote MongoDB database.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 13, 2019, 1:04pm UTC](https://community.n8n.io/t/credentials-error/181/4 "2019-10-13T13:04:36Z")

</div>

Sorry sadly not. That seems like something where a solution would have to be found in Heroku. You have to find a way there to persist that folder. Never used Heroku so can sadly not be of any help there. But it sounds like something that should be possible.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 13, 2019, 6:28pm UTC](https://community.n8n.io/t/credentials-error/181/5 "2019-10-13T18:28:59Z")

</div>

Ok so now finally home in front of my computer and could so finally check the code. I was not sure if I did add the possibility to also set the encryption key via an environment variable. And good news, I did. So if you can set an environment variable on Heroku you can fix your problem like that.

Set the variable `N8N_ENCRYPTION_KEY` to a random string and then recreate (so delete and create again) all the credentials you had. Then you should be good to go.
