Try ERPNext Buy Support Partners Foundation

frappe.exceptions.ValidationError: Encryption key is invalid, Please check site_config.json

worked

i found a simple solution for those who do not know how to modify their database manually
First download erpnext virtual image to your local machine ( always keep one working in case of any requirements)
second keep the version of erpnext to 8.7 P.S. do not update it here,
thirst create a new site and import your database to it and migrate your site
fourth access your local website, login and modify default email accounts to none and delete all email setting created
fifth using bench make a new backup of this database and upload it to your cloud server and migrate it,
It will work floawlessly with new erpnext version
Hope it helps

Same errors appears after replacing key.

I can’t get the encryption key in the original site1.local site_config.json file(it is missing), i only get the encryption key in my custom app site_config.json file which cause me encryption key is invalid.

Can i know the reason why encryption key is not present in site1.local ? where can i get it ? Note: i read some of the code and i realize in my db._Auth , the attribute encrypted is 0 of all Users, but the password is like encrypted string in db.

hi, can anyone help me in this regard, i restored after a system crash, and lost my earlier encryption key…

is there any way to enable my email account to send invoices again ?

same problem here when creating new User I got this error and I didn’t made any changes to my server !!
anyone solve this issue ??!!

come on guys, there are so many developers here, anyone ? please help

Hi,
Please try editing both Email Domain and Email Account and saving.
Thanks

1 Like

thank ranjith for ur reply, but i ve tried it already its not working !

can u suggest me something else

@tanuj82685
removing email account and adding manually is one of solution else you can try removing encryption key from site_config.json system will auto create

i ve tried to remove encryption key from site_config.json, it gives error

if it works, can u guide me detailed steps

I am getting this same error after a restore of a backup ver 10 from one server to another why is the encryption key not included with the backup and restore procedure? Second how do I fix?

Copying this does not work why wasn’t this included in the backup is its so crucial? it is very plausible that some one would restore to a different machine?

ok I have looked in the s3 backups and dropbox backups and can not locate site_config.json. So my question is if the encryption keys are critical to things like email functioning why are they not included in the backup protocol and further why was this not discussed in the backup and restore documentation. As previously posted we have moved servers and are now left with a broken ERPNext installation despite following the restore documentation. If some one knows how to fix this as the old server was decommissioned and is no longer available it would be helpful. I have months of backups but apparently do not have the site_config.json

I will also add that we did try to do sudo bench setup lets-encrypt sitename and it completes fine and adds the encryption key to the site.confi.json but still fails.
Ok looks like I may have stumbled on to something.
After running sudo bench setup lets-encrypt sitename then go into email accounts and try to change the password. I did this for all of our accounts and mail seems to flow.

I would still like to understand why site_config.json is not included in the backup protocol if someone could comment on that it would be helpful?

imllc imo your questions and initiative highlight say a ‘best practice’ conundrum?

Hence ERPNext docs are limited or forum response and so on are perplexed or mute…

This food for thought piece may help with your discussion http://aspg.com/10-tips-for-securing-encryption-keys/#.WlEhz6x95pg

Protect your most critical data and your access to it by following these tips for securing encryption keys

For example these snippets -

Do not store encryption keys with the data they decrypt: Encryption keys should be stored on separate machines from the data they are used to unlock. When they are both located on the same machine, if that machine is compromised so also are the keys.

Maintain a secure and frequently updated off-site backup of encryption keys: Having all your encryption keys locked up and on one secure machine does no good if that machine fails. If all the keys are lost in a drive failure, the encrypted data will become inaccessible.

At some point the user must be cognizant of their responsibility?

1 Like

For us this was a sort of hidden requirement we didn’t even know the existence of the encryption keys in site_config.json and its dependency had we known that we would have certainly factored that into our solution. When a product says it has a backup solution and a restoral methodology one generally believes that the makers of the software know what they need and include everything necessary for a working restoral but in this case that was not true. We found a work around and hope it saves others the trouble we experienced. We have implemented a different backup routine going forward. Were just glad we had not fully implemented before we discovered this discrepancy…

Well the saga continues found another little gem seems my dropbox backup failed last night:
Backup Upload Failed
Oops, your automated backup to Dropbox failed.
Error message:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 45, in take_backup_to_dropbox
did_not_upload, error_log = backup_to_dropbox()
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 83, in backup_to_dropbox
dropbox_settings = get_dropbox_settings()
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 195, in get_dropbox_settings
if settings.app_secret_key else frappe.conf.dropbox_secret_key,
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 637, in get_password
return get_decrypted_password(self.doctype, self.name, fieldname, raise_exception=raise_exception)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/password.py”, line 16, in get_decrypted_password
return decrypt(auth[0][0])
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/password.py”, line 120, in decrypt
frappe.throw(_(‘Encryption key is invalid, Please check site_config.json’))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Encryption key is invalid, Please check site_config.json
Please contact your system manager for more information.

Not sure why amazon s3 backup is working and not dropbox I guess s3 does not rely on the keys??

1 Like
1 Like

NEW UPDATES on how to fix the encryption error.

I read @Ranjith comment here ( frappe.exceptions.ValidationError: Encryption key is invalid, Please check site_config.json ) by saying:

It did not work by editing. What I did is that I deleted Email Account and Email domain and added them again. And it works now.

If you are having this issue try to follow these steps and let me know. I just wants to be sure.

Cheers!

2 Likes

@Ranjith This really solved my problem +1 Thank you

2 Likes