How to fix No secrets files found. Valid paths for a secrets.toml file are: /root/.streamlit/secrets.toml

Dhiraj Krishna Kumar 0 Reputation points
2024-01-13T17:01:34.5233333+00:00

Hello, No matter how I try - I keep getting following error on my app "No secrets files found. Valid paths for a secrets.toml file are: /root/.streamlit/secrets.toml, /tmp/8dc14577c10446d/.streamlit/secrets.toml" I have .streamlit/secrets.toml in my github. I see it but I feel it is not getting pushed to Azure while deployment. How can I fix that error? Regards, Ninad

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
41,987 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jagan Rajagopal 0 Reputation points
    2024-01-15T10:55:04.91+00:00

    Please check the below setting as mention in below

    Check Deployment Scripts: Ensure that your deployment process includes the .streamlit/secrets.toml file. Sometimes, files starting with a dot (like .gitignore, .env) can be ignored by deployment scripts or version control systems. Verify that your deployment scripts or the Azure DevOps pipeline settings include this file. Verify File Path: Ensure that the secrets.toml file is located in the correct directory within your repository. It should be in a .streamlit directory at the root of your repository. Include File in Repository: If you're using Git, ensure that the .streamlit/secrets.toml file is tracked by Git. You can check this by running git ls-files to see if the file is included in the list of tracked files. Check .gitignore: Make sure that the .streamlit/secrets.toml file is not listed in your .gitignore file. If it is, it won't be pushed to your repository and therefore won't be deployed to Azure. Manual Upload: As a workaround, you can manually upload the secrets.toml file to the correct path in your Azure App Service using FTP or through the Azure portal. While this is not ideal for automated deployments, it can be a temporary solution. Environment Variables: If the secrets.toml file contains sensitive information, consider using environment variables for deployment in Azure. You can set these variables in the Azure App Service configuration.

    1. Logging and Debugging: Add logging to your application to confirm the file paths it's trying to access. This can help you understand where your application is expecting the secrets.toml file to be.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.