icecap
Returning Socket.connect/2 error to phoenix.js
Hi everyone
Just updated phoenix.js to latest where the .onError signature seems to have changed
Previously, I was just getting the status code as a string. Now I’m getting an object with shape
{
isTrusted: false,
message: "Expected HTTP 101 response but was '[Status Code] [Status Code Label]'"
}
Not sure exactly what happened.
That being said, I also discovered since I last updated my deps that Socket.connect/2 return value also got updated, now allowing you to return {:error, term} instead of just :error
I tried doing just that, as well as implementing the Endpoint websocket error_handler as instructed here, however, I get the same error object as above (and yes I restarted the server)
conn |> Plug.Conn.send_resp(401, "this string never makes it RIP")
returns err on the js client socket instance socket.onError(err =>
{
"isTrusted": false,
"message": "Expected HTTP 101 response but was '401 Unauthorized'"
}
The only part that changes in the response is the string following ... response but was
Any ideas?
NB: Currently circumventing with
err.message.toString().includes(statusCode)
Popular in Questions
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









