"AxiosError: Network Error" when uploading XLSX file

Hello everyone,

I have an app deployed with Digital Ocean, using Streamlit 1.30.0 and Python 3.10.0. I am having some trouble debugging “AxiosError: Network Error”. Here is the code to upload the file.

uploaded_file = st.file_uploader("Upload initial data for the new dataset",
                                         type=['csv', 'xlsx'], disabled=not valid_dataset_name(new_dataset_name))

        if uploaded_file:
                progress_text = "Uploading dataset file."
                uploads_progress = st.progress(10, text=progress_text)

                # Check the type of file.
                if uploaded_file.type == "text/csv":
                    data = pd.read_csv(uploaded_file, header=0)
                elif uploaded_file.type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
                    data = pd.read_excel(uploaded_file, header=0, sheet_name=None)
                    data = pd.concat(data.values(), ignore_index=True)

When I upload a small file (around) 65 KB, the behavior is as expected; however, if the file to be uploaded is considerably larger (around 1.1GB), it yields “AxiosError: Network Error”, as shown below.


Any help is very much appreciated.

Hey @AfonsoBernardes . Once downgrade the streamlit version and give a try. Hope it works

Happy Streamlit-ing :balloon:

Any specific version I should consider?

@AfonsoBernardes anything in 20’s range

1 Like

Thank you for your reply. I tried deploying almost every version in the 20’s range but without success.

Hi @AfonsoBernardes

Have you tried configuring the .streamlit/config.toml file so that maxUploadSize has a value larger than the intended file size:

maxUploadSize = 1500

More info in the Docs:

Hope this helps!

Thank you for your input; however, the maxUploadSize=2024 is way above my file’s size (1.1GB). Therefore I believe that is not the issue here.

Hi @AfonsoBernardes,

I think this could be a limitation of a allowed packet size between your app and NGINX on Digital Ocean. I faced a similar problem on one of my app deployed on Kubernetes and I had to increase the limits on NGINX to allow a bigger file to be uploaded. I had made changes on the ingress yaml as below to allow files upto 200 MB.

apiVersion: networking.k8s.io/v1
kind: Ingress
name: {{SERVICE_NAME}}-ingress1
namespace: {{NAMESPACE}}
nginx.ingress.kubernetes.io/proxy-body-size: “200m”

I hope it helps.