I deployed my
streamlit app via Google Cloud Run and have been experiencing 404 errors for one of the apps (there’s 16 mini apps in total) [SEO/Social > Bulk SEO Stats Checker]
Download function code:
towrite = io.BytesIO()
# write to BytesIO buffer
df.to_excel(towrite, encoding='utf-8', index=False, header=True)
# reset pointer
return st.download_button("Download", towrite, file_name="Guidesify_App.xlsx", mime='data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
The app has a download button to export the generated dataframe as a .xlsx file and this works perfectly fine locally but breaks sometimes on GCP. When the 404 error happens, users have to refresh/resubmit their query to generate a new download.
Initially, I thought it could be something to do with
Deploying Streamlit on GCP (Cloud Run): problem when using new multipage app feature but applying the suggested fix did not solve this issue.
Was thinking if this has to do with the maximum requests per container field (screenshot attached below).
Appreciate any help thanks!
Stumbled upon this. If you haven’t figured it out yet, I think the need for sticky routing is why:
12:00PM - 14 Dec 21 UTC
In my Streamlit app deployed in a standalone Docker container, lo
… cal files can be uploaded via **st.file_uploader** without any problems. However, for the same app deployed on Kubernetes cluster in multiple replicas setting, st.file_uploader randomly returns HTTP status code 400 with an error message like:
_**400: Invalid session_id: '1d319bd4-b1dc-4149-bfb2-24cdd48f3982'**_
The behaviour is non-deterministic - reloading (sometimes more than once) the browser tab helps.
### Steps to reproduce
- Deploy a Streamlit app on Kubernetes with multiple replicas
- Run the app in a browser
- Select any file in st.file_uploader's window.
- If the error doesn't occur, reload the browser tab and try again.
st.file_uploader("Choose a file")
st.file_uploader works exactly the same way in a single Docker container and when deployed on Kubernetes cluster with multiple replicas.
### Debug info
- Streamlit version: 1.0.0
- Python version: 3.7.8
- continuumio/miniconda3:4.9.2 Docker image
### Additional information
The problem was reported previously in a comment https://github.com/streamlit/streamlit/issues/2803#issuecomment-948079579 , but without specific details.
I’m looking for an easy fix too but I don’t think there will be one.
Thanks, this post definitely explains why. I have not found the solution yet and ended up building a Svelte + Supabase version of it lol!