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:
try:
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.
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.
I’ve also experienced this, for an Excel file that is 100MB in size.
Hosted on Azure Web Service.
However, when debugging, I’m not able to replicate the bug. I have tried using a different laptop and also tried another wifi network, but neither gave me the AxiosError. It still showed AxiosError on the previous laptop though.
I restarted the laptop with AxiosError, and it miraculously disappeared. Not sure where the bug is coming from…?