Pending server and Connection Time out when deployed on Heroku Server

I have somehow hosted the streamlit webapp on Heroku.
Now whenever I try to open the URL or refresh the page with Shitf+R, it takes a lot of time, the web app shows Please Wait... and the chrome console shows this error a lot of times:

Uncaught Error: Unsupported state transition.
State: PINGING_SERVER
Event: CONNECTION_TIMED_OUT
    at bt.stepFsm

I have attached a screenshot of the chrome console in web browser too.

And then after 5-10 minutes of waiting, the app is loaded entirely. And my app isn’t very fancy too. It just uses saved scikit-learn’s RandomForestClassifier to classify the categorical or numerical input data.

2 Likes

I am facing the similar problem. Whenever I try to open the URL it takes a lot of time to load the web application showing the similar error as above.

Same here, app hosted on EC2 instance (AWS)
Has anyone solved this problem?

Same here. Same issue. did anyone resolved it yet?

Same here, facing the same issue

I faced the same issue when I integrated Streamlit with Nginx on AWS EC2 (Ubuntu). Somehow our team fixed this issue

The fix is here:

Streamlit config:

[server]
port=8502 # change port number. By default streamlit uses 8501 port
headless=true # This will eliminate automatically open browser
[browser] # This ip and port will show in command prompt
serverAddress = "abc.com" # Put your Local IP or Domain Name
serverPort = 8502

Nginx setup:

server {
    listen 80;
    server_name abc.com www.abc.com;
    index index.php index.html index.htm;
    location / {
        proxy_pass http://0.0.0.0:8502/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}