Error on Cloud Run: “Tried to use SessionInfo before it was initialized” when selecting files

When hosting my Streamlit app on Google Cloud Run, attempts to select or upload a file sometimes fail silently. Inspecting Chrome’s DevTools “Sources” panel reveals an unhandled promise rejection:

Error: Tried to use SessionInfo before it was initialized
    at SessionInfo.get (session_info.ts:45)
    at FileUploader.onChange (file_uploader.tsx:102)
    …

This only occurs in the Cloud Run deployment—on localhost the file picker always works. It appears that after a reconnect (for example, following a brief idle period or network hiccup), Streamlit’s front-end clears its internal SessionInfo and then never re-initializes it before handling the file‐picker promise.


Steps to reproduce:

  1. Deploy a basic Streamlit app with a st.file_uploader to Cloud Run.
  2. Open the app in Chrome and leave it idle for several minutes (or trigger a network reconnect).
  3. Attempt to click the file uploader button.
  4. Observe in DevTools → Console / Sources that an unhandled promise rejection fires with “Tried to use SessionInfo before it was initialized.” The file selection dialog does not appear, and the upload never proceeds.

Expected behavior:
After a reconnect or idle timeout, Streamlit should re‐establish its SessionInfo before handling UI events such as file uploads. The file picker dialog should open reliably, without throwing an error.


Actual behavior:
The front‐end throws an unhandled promise rejection and silently fails to open the file picker. Users must manually reload the page before they can select files again.

Did Cloud Run terminate your server process (it leave logs when doing so)? Cloud Run has a switch for that when the service has no new requests for a while.

In this case it would be hard or impossible to “re-establish” a session in server side. The new process could be running a different image, in a clean filesystem, sharing nothing with previous one.