WebsocketConnection WebSocket onerror

Hey there I am getting an error to connect to WSS, i think the error occurs whem promote ws to wss.
The page keeps Loading “Please wait…” and on developer tools the wss calls failed.
“WebSocket connection to ‘wss://streamlit.us.stg.xpto.cloud/_stcore/stream’ failed”
On deployment the ingress is configured to redirect to ssl.

Facing the same issue, it appeared before I had configured ssl cert and also after I configured it. Have tried almost anything including /_stcore/stream location blocks to the nginx configuration.

Would really appreciate if someone can help out

I managed to fix it, my /_stcore/stream location block in nginx had a typo, it works now.

Could you please elaborate more, because I am having the same issue. What was the typo? Thanks!

@Elshan_Gadimov
So, My location block in nginx conf file was

location /_stcore/streamstream {
}

instead of

location /_stcore/stream {
}

That extra “stream” was the typo.

1 Like

This is the final working nginx conf for anyone who’s facing issues.

server {
    server_name website.com;

    location / {
                proxy_pass http://127.0.0.1:8501/;
                proxy_set_header        Host $host;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Forwarded-Proto $scheme;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
    }

        location /_stcore/stream {
                proxy_pass http://127.0.0.1:8501/_stcore/stream;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 86400;
        }

}
3 Likes

Any idea what to do if we are using an AWS load balancer for HTTS, SSL termination and not Nginx?
HTTPS → ALB → EC2 is how it is setup.

I get the same web socket time out issue while accessing the application through the domain name, but works perfectly accessing the ec2 instance directly. It shows “please wait” for a couple of minutes while the web socket “_stcore/stream” retries multiple times and finally loads up the page after a long delay. Tried almost everything in the support channels including setting up flags, upgrading versions etc but no luck. Streamlit 1.24.0 and python 3.9 (tried 3.10 but still no luck)

2 Likes

I am having same issue. Any luck?

I have been facing similar issue. My configuration is azure app proxy → network load balancer → app load balancer(443) → EC2 (80). If I hit the n/w load balancer directly there is no issue, when i include proxy to the mix i start getting Please wait and failures related to _stcore/stream. If anyone has a solution for this, please let me know.

1 Like

Did you get a solution for this? Please let know if you do.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.