This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-15
Channels
- # announcements (11)
- # aws (5)
- # babashka (69)
- # beginners (138)
- # calva (5)
- # cider (11)
- # cljsrn (3)
- # clojure (86)
- # clojure-europe (8)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-norway (13)
- # clojure-uk (21)
- # clojurescript (13)
- # conjure (58)
- # core-typed (2)
- # data-science (2)
- # datomic (5)
- # degree9 (4)
- # emotion-cljs (4)
- # figwheel-main (8)
- # fulcro (29)
- # graalvm (70)
- # interop (2)
- # joker (1)
- # lein-figwheel (2)
- # leiningen (13)
- # liberator (4)
- # off-topic (21)
- # pedestal (2)
- # re-frame (10)
- # shadow-cljs (42)
- # spacemacs (29)
- # spire (1)
- # tools-deps (11)
- # vim (26)
- # xtdb (5)
By the way: nice job on node target! The console is being redirected to the REPL! Great job @thheller!
@mauricio.szabo which version? I added the reconnect logic in 2.10.7.
@thheller Wow, I missed by 0.0.1 😄. It was 2.10.6 (just saw that 2.10.7 is indeed reconnecting). Thanks 😄
Hi, had anyone struggled with an error like the following while working with the react-native target in Android?
> WebSocket connect failed:Expected HTTP 101 response but was '200 OK'
I don't have a clue about how to debug such a thing. I'm trying different things like updating shadow to the latest version, destroying/creating a new ADV. I don't get any significant log errors from react-native log-android
.
What step is this at? I think this is a metro bundler issue - it initiates the websocket connection.
Could also be a REPL, since that would also initiate the WS connection. The first step when hitting something like
is for the server sending websocket messages to give a 101 Switching Protocols message, so whatever process accepts that connection is where to look. I don't think checking on-device logs will get you what you want
Huh. It happens once the application starts, after loading it with react-native run-android
. Well, the error message also says It was trying to connect to:
. I checked with --verbose
when running shadow and I see the line Using IP: 192.168.0.62
.
Is there another process on your machine running on 9630? I'd check to see what process has that port, just to double-check that it looks like something related to react native and not another microservice or some other piece of software
A webserver running on that port might return 200 OK for the initial HTTP request used to start a websocket connection
Although I don't know if the device should do the websocket connection with shadow or the Metro thing
Probably both - flipper opens a websocket connection to metro to make its displays work, and shadow would open a websocket connection to run the REPL
I guess that points to a shadow issue - what version are you using?
> flipper opens a websocket connection to metro React native really has a way of making you write some bizzare things. Flipper is react-native-specific devtools software, developed and maintained by facebook
And metro is a process that watches for changes to JS files in your project, bundles them into one big JS file and transforms the AST to properly reference images and other react native things, and swaps out the JS file used by the react native project on your simulator.
I'd try a curl/postman request to GET http://localhost:9630, so that you can see what it responds with
Based on the process here: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Client_handshake_request
Thank you for all the info, it's very helpful! I'm using latest shadow-cljs (2.10.8). From what you say it looks more likely a problem with shadow. Doing curl -i
returns that 200 OK response, which makes sense because that's were the web UI of shadow is.
@franquito no clue why you'd be getting a 200. maybe a proxy of some kind in the middle?
does the UI work at http://192.168.0.62:9630? from your machine and/or the android browser? it also connects to the same websocket location as react-native should? so if that works properly we can rule out shadow-cljs.
The UI works from the machine and the device too. > it also connects to the same websocket location as react-native should? How can I check that?
Oh, yes. The console shows that initial websocket error connection and then logs WebSocket disconnected!
I just disabled debugging and got a different error Error: addEventListener and attachEvent are unavailable.
The shadow-cljs UI in http://192.168.0.62:9630/ is working properly. You can even do a force compile.
[15:32:23] D | ReactNative ▶︎ ReactInstanceManager.onJSBundleLoadedFromServer()
[15:32:23] D | ReactNative ▶︎ ReactInstanceManager.recreateReactContextInBackground()
│ ReactInstanceManager.runCreateReactContextOnNewThread()
└ ReactInstanceManager.tearDownReactContext()
[15:32:23] D | ReactNative ▶︎ CatalystInstanceImpl.destroy() start
└ CatalystInstanceImpl.destroyV1() start
[15:32:23] I | ReactNative ▶︎ [GESTURE HANDLER] Tearing down gesture handler registered for root view com.facebook.react.ReactRootView{379a637 V.E...... ......ID 0,0-1440,2392}
[15:32:23] D | ReactNative ▶︎ ReactInstanceManager.createReactContext()
└ Initializing React Xplat Bridge.
[15:32:23] D | ReactNative ▶︎ Initializing React Xplat Bridge before initializeBridge
[15:32:23] D | ReactNative ▶︎ CatalystInstanceImpl.destroy() end
[15:32:23] D | ReactNative ▶︎ Initializing React Xplat Bridge after initializeBridge
[15:32:23] D | ReactNative ▶︎ CatalystInstanceImpl.runJSBundle()
│ ReactInstanceManager.setupReactContext()
│ CatalystInstanceImpl.initialize()
└ ReactInstanceManager.attachRootViewToInstance()
[15:32:24] D | ReactNative ▶︎ ReactInstanceManager.createReactContextInBackground()
└ ReactInstanceManager.attachRootViewToInstance()
[15:32:25] E | ReactNativeJS ▶︎ Error: addEventListener and attachEvent are unavailable.
[15:32:25] I | ReactNativeJS ▶︎ Running "NewApp" with {"rootTag":61}
[15:32:25] E | ReactNativeJS ▶︎ Invariant Violation: "NewPibe" has not been registered. This can happen if:
│ * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
└ * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
[15:32:25] I | ReactNativeJS ▶︎ #4 ready!
Invariant Violation: "NewPibe" has not been registered. This can happen if:
│ * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
└ * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
I can recompile from the UI. Yes, it's strange to get that message about component registration. I will try with a git bisect on my repository. Thanks for all the help! 🙏
Error: addEventListener and attachEvent are unavailable.
no clue about this one but the other one above looks like you are maybe calling registerComponent
with the wrong name or not at all?
I can recompile from the UI. Yes, it's strange to get that message about component registration. I will try with a git bisect on my repository. Thanks for all the help! 🙏
The problem was a bug on a new version of re-frame, It was already reported https://github.com/day8/re-frame/issues/604.