Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbo Stream 500 (Connection error) #45

Open
smeetsomaiya opened this issue Dec 12, 2022 · 6 comments
Open

Turbo Stream 500 (Connection error) #45

smeetsomaiya opened this issue Dec 12, 2022 · 6 comments
Labels
question Further information is requested

Comments

@smeetsomaiya
Copy link

This issue pops up every now and then. I am unable to figure out what causes it

Screen Shot 2022-12-12 at 1 22 07 AM

@simon-bueler
Copy link

simon-bueler commented Jan 23, 2023

I got the same issue. It launches a GET to /turbo-stream without calling the actual site I implemented a stream on. Any update on this issue, or any way I can help with fixing this?
Issue is present on v0.8.3 but not on v0.8.2

@miguelgrinberg
Copy link
Owner

@simon-bueler what version of Werkzeug do you have? You may want to try upgrading Flask and Werkzeug to latest (if you can), as I believe this is only a problem with older releases.

In any case, this issue occurs due to being very difficult to get Werkzeug to handle a WebSocket route. Since you will be using this web server only for development this isn't a major problem. Once you switch to Gunicorn for your production release this isn't going to happen anymore.

@miguelgrinberg miguelgrinberg added the question Further information is requested label Jan 23, 2023
@simon-bueler
Copy link

@miguelgrinberg I use:
Flask>=2
werkzeug>=2

which results in
Flask 2.2.2
werkzeug 2.2.2

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented Jan 23, 2023

@simon-bueler Well, as I said, Werkzeug has been very difficult to tame wrt having a WebSocket route. I may have another look at some point, but given that this is a development web server I do not consider it the highest priority. The error occurs when the WebSocket connection is closed, so you can still use Werkzeug during development and it should work just fine with the exception of this error when a client goes away.

Also, just to clarify, the version of this package doesn't really matter much. The problem occurs between Flask-Sock and Werkzeug.

@simon-bueler
Copy link

@miguelgrinberg I tried gunicorn to run my app and as you said I did not encounter the issue there. On the other hand it was extremely slow in comparison and ran into multiple WORKER TIMEOUT issues and my turbo stream didn't run at all. So not sure if this is due to my use of msal but I will see what I can do. Just leaving this here if someone facing similar issues.

@simon-bueler
Copy link

Found a suitable solution for my case. Issue was, that the login procedure of msal somehow generates a call to /turbo-stream which resulted in a ssl.SSLEOFError: EOF occurred in violation of protocol which caused a ERROR:app:process_auth_redirect: security violation () for the login.
Since the site where the stream should run is only available when loged in, I added a block to the main template for the {{ turbo() }} part and only load it on that site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants