-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change SECRET_KEY and get error ValueError: Invalid decryption key
on K8s
#8538
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Hi @newtonjose, This is probably because you already have database connections that were encrypted with the old key. You have to recreate them or update |
how to recreate or update ,this page get error |
i got an solution, add a config DB_SECRET_KEY in config.py it's value is origin SECRET_KEY, then use config["DB_SECRET_KEY"] replace config["SECRET_KEY"] in superset/models/core.py Database model |
I used a different approach: |
The databases page would not load for me after changing the
Now the databases page will load but clicking edit on certain databases still didn't work and caused this stack trace:
Create a new database (e.g. name = "New DB") from the UI. You can get the SQLAlchemy URI using this SQL:
Once the new database is created, back in
|
I've unfortunately encountered this and here's what I've done to fix this:
|
I've encountered the same issue when upgraded superset to 1.4.1 from 1.4.0.
|
just sharing my observation that having same secret_key and connecting the from the different host fails with invalid decryption key. would like to know views from community.( i think this by design) |
I had the same issue when I use docker-compose to install superset on MacOS. Due to it is my local test, it is easy for me just to remove old containers and old data and start fresh.
The key point is you need to remove old volumes. |
Same for me, upgrading (in my case from 1.3.2 to 1.4.2rc1) breaks the encryption, even if the SECRET_KEY stays exactly the same (Superset even warns about using the default SECRET_KEY). |
In step 3 I'm getting a syntax error. |
@andtlopez thanks for the hint. Same issue. But what I also wanted was to change SECRET_KEY from default one to new one. I couldn't find anything about how to decrypt paswords with the SECRET_KEY. I found useful to decrypt passwords from working superset before upgrade. To do that:
Hope it'll help! |
I have upgraded superset from |
I just ran |
I ran into this too when updating the SECRET_KEY, the most reliable/surgical fix seemed to be:
💡 UPDATE: in a classic RTFD moment, looks like this is far simpler if you just rotate secrets the right way: https://superset.apache.org/docs/installation/configuring-superset/#secret_key-rotation |
And I get
Nope, this does not help. |
What I do not understand is this : I can open the SQLite database with even if there is actual data in the
When I create a new database, using Superset, the database is created in the SQLite database, but it is still not listed. Why is it complaining about an "invalid decryption key" when the database is fully readable! How to fix this? |
This workaround #8538 (comment), assumes that the meta-data db is using postgres; in my case it was sqlite. So the steps in my case where:
I only changed step 2. |
Do note that superset has a cli for this: https://superset.apache.org/docs/installation/configuring-superset/#secret_key-rotation |
i use delete dbs data is ok; |
this worked for me |
hi sir, can you tell me where is config["SECRET_KEY"] in superset/models/core.py Database model, really i dont find it, thankyou |
This solved it for me! update sl_datasets set database_id = 5 where database_id = 2;
update sl_tables set database_id = 5 where database_id = 2; |
Just to help anyone else coming across this. Trying to migrate / upgrade superset using backup of postgres metadata, shifting to new version. First, fix secret keys in superset_config.py PREVIOUS_SECRET_KEY = 'CHANGE_ME_TO_A_COMPLEX_RANDOM_SECRET' <= determined original key from other (original) installation by getting session on superset container: superset shellthen:
<= generate from: Second, ensure to specify a version in your docker-compose config: Third, as per comments above, update the password and encrypted_extra values for your db connections in the restored metadata db: Fourth, you should now be able to login to superset ui, go to database connections, and just re-enter the password(s) for your database(s) - then the dataset(s) for those databases come back to life. |
modify in config.py : then exec: superset re-encrypt-secrets |
step 7, what uri for that? |
|
I also met this problem, may I ask how you finally solved it? |
How does step 2 here access the sqlite3 client and connect to the sqlite.db file? |
I unfortunately cannot remember my previous secret key (My config file got deleted, somehow), please help!!! |
You can try to reset your secret key by using |
@yjcsivsuk Can you please elaborate a little more on the steps? where should I export the key? Is the only step needed? restart? I'm in the same case as @Teesmo, I don't have access to my previous secret key. |
Ok so I spent all day on this and finally got it so I'm going to add some more detail to help others out. We had a previous deployment running on K8s deployed from Helm. I upgraded to 3.0.0 and tried setting the A couple things I found to be true for me was that setting:
did not in fact set the After all that, these are the steps I followed to get it to work:
deploy these changes. Hopefully this helps someone not spend the time I did figuring this out. |
When I try change
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'
(default), to(for example):
I getting the error
ValueError: Invalid decryption key
insqlalchemy_utils
when on executesuperset-init
.To reproduce:
Expected results
Actual results
Screenshots
If applicable, add screenshots to help explain your problem.
How to reproduce the bug
Environment
(please complete the following information):
superset version
0.34.1
python --version
3.6.1
node -v
npm -v
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: