My app was working well, but after rebooting it is giving error about secret manager

Summary

My app was working well, but I did a reboot because it was not taking the most recent changes done in the repository.
After the reboot it is giving an error with the following trace back:

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)File "/app/virtualassistant/chatbot.py", line 19, in <module>
    from streamlit.secrets import SecretManager

the secrets TOML is set with the key.

Any help will be appreciated

Take a look at the docs on secrrets management.

Goyo, thanks for your reply.
Checking the docs, I found that the lines #from streamlit.secrets import SecretManager, and
#openai.api_key = SecretManager.get(‘OPENAI_API_KEY’) are NOT documented. I changed them to #st.secrets… as documented, and the app returned to life!!! Thanks for that, but now I have another question: Where could I have found those lines I was using (where there in the docs before?), and moreover why they were working well until the reboot of the app? If you have an idea please let me know. It would be nice to understand it.

I have no idea. I don’t remember ever seeing anything like that.

Apparently you added that code on May 30th, along with a long comment that I don’t quite understand. It is weird that you don’t remember why you wrote that code and comment five days ago. I am quite sure there were no references to a streamlit.secrets.SecretsManager in the docs at that time.

If you deployed about that date for the first time the installed Streamlit version should have been 1.22.0 (released Apr 27th), which doesn’t have a streamlit.secrets.SecretsManager either, so I don’t know how that could have ever worked.

Hi. Thanks again for taking your time to check it. I’m really new to this, so I grabbed info from many different places, that’s why I don’t remember where I read about that secretmanager. the weird thing is that it worked perfectly until the reboot of the app. Anyway, thanks again, I’ll keep learning.

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