I am attempting to deploy streamlit app on my Google Cloud project as a cloud run.
I have been using streamlit on gcloud for a while (only single-page apps).
I’ll describe the problem here:
- Dockerize streamlit multipage app.
- Serve dockerized streamlit on Gcloud run via the following command: `gcloud beta run deploy myapp --project project_id --image gcr.io/myapp:dev --platform managed --allow-unauthenticated --memory “4G” --timeout “3600” --cpu 4 --concurrency 10
- Access the home-page → it works:
- Select another page inside the app (also works!):
- THE PROBLEM: if I try to access a secondary page directly from URL (simple F5 from last pic), I get the following state:
I tried investigating the cause of this problem for a while now, but up to this point I didn’t find any solution!
When deploying my docker image locally this does not happen (F5 works fine).
Also, the st.download_button() is not working on my Cloud Run instance…
+1 also having this issue on GCP with Cloud Run when trying to access any page besides the main the page via the url, i.e. my.page works but my.page/subpage does not.
Try to use your browser inspection tool to understand what is the difference between the requests from Cloud Run server before and after refreshing on the page. Increase ‘–logger.level’ could help to debug the requests in the server side. My actual guess would be that there is a server configuration problem, because you can connect to the server without using /subpage, so there is a huge chance that is not GCP network configuration problem. For the same reason I think that is not docker container configuration problem (but I could be wrong).
I had the same problem to access my app, but my problem affected all the pages when using Github Codespaces to develop the code. I would recommend to try the solution of this topic, maybe would resolve.
The starting script
streamlit run <file>.py --server.enableCORS false --server.enableXsrfProtection false