tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.52k stars 296 forks source link

Websocket error on M1 iMac Monterey #4746

Closed amancevice closed 2 years ago

amancevice commented 3 years ago

Expected Behavior

tilt up [space] should open the Tilt GUI

Current Behavior

UI is a blank page with the text Loading...

Inspecting the console there is an error connecting to the websocket:

WebSocket connection to 'ws://localhost:10350/ws/view' failed: The operation couldn’t be completed. (kNWErrorDomainPOSIX error 100 - Protocol error)

Steps to Reproduce

  1. Use M1 iMac with macOS Monterey beta
  2. install tilt
  3. create simple Tiltfile
  4. run tilt up [space]

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.21.2, built 2021-07-06
System: darwin-arm64
---
Docker
- Host: [default]
- Server Version: 20.10.7
- API Version: 1.41
- Builder: 2
---
Kubernetes
- Env: none
- Context: 
- Cluster Name: Unknown
- Namespace: default
- Container Runtime: unknown
- Version: Error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
- Cluster Local Registry: none
---
Thanks for seeing the Tilt Doctor!
Please send the info above when filing bug reports. 💗

The info below helps us understand how you're using Tilt so we can improve,
but is not required to ask for help.
---
Analytics Settings
--> (These results reflect your personal opt in/out status and may be overridden by an `analytics_settings` call in your Tiltfile)
- User Mode: default
- Machine: cccd0cd5bc37bdcb11c3db0a89a68e9d
- Repo: 

About Your Use Case

Not an urgent issue as Tilt works fine on my work machine, just raising as a potential issue for future users

nicks commented 3 years ago

Thanks for filing! Will be useful if anyone else runs into it. Sounds like Websockets are broken on the MacOS beta

@amancevice have you tried using a different browser? Wondering if they're broken on Safari, or if macOS Monterey beta has some kind of new security firewall that accidentally broke websockets. Might also be good to poke around in the macOS issue tracker

amancevice commented 2 years ago

@nicks thanks & sorry for the delay — I was out of town for a while but am back in front of my M1 iMac — I just upgraded to the latest macOS public beta and can confirm that:

I'll poke around and see what I can find

henriquebremenkanp commented 2 years ago

@nicks Looks like something changed when handling websockets in Safari 15. It still works on other websites, tested on socket.io website.


Edit: works fine on Safari 15 / BigSur 11.6 (Intel)

redvex commented 2 years ago

JS console reports:

WebSocket connection to 'ws://localhost:10350/ws/view' failed: The operation couldn’t be completed. (kNWErrorDomainPOSIX error 100 - Protocol error)

It doesn’t work on the iPad (all browsers using port forward to access localhost:10350)

jazzdan commented 2 years ago

Also seeing this:

WebSocket connection to 'ws://localhost:10350/ws/view' failed: The operation couldn’t be completed. (kNWErrorDomainPOSIX error 100 - Protocol error)

Safari 15.0 macOS 12.0

nicks commented 2 years ago

i can repro after upgrading to Monterey! though not sure what's going on yet :thinking:

nicks commented 2 years ago

Looks like a bug in Safari's new NSURLSession Websocket feature, which got turned on by default in Monterey.

You can go to Develop -> Experimental Features -> NSURLSession Websocket to turn it off, and the tilt UI will work OK.

nicks commented 2 years ago

Here's some interesting discussion on this: https://github.com/gorilla/websocket/issues/696 https://github.com/gorilla/websocket/issues/731#issuecomment-949021678

Not super familiar with websocket messaging, but looks like they now declare they support Sec-WebSocket-Extensions: permessage-deflate, but didn't actually implement it correctly :angry:

redvex commented 2 years ago

Looks like a bug in Safari's new NSURLSession Websocket feature, which got turned on by default in Monterey.

You can go to Develop -> Experimental Features -> NSURLSession Websocket to turn it off, and the tilt UI will work OK.

Works on the iPad too 😬