Open WillooWisp opened 2 years ago
I have the same issue!
Can you please test with this dev release and see if the problem still occurs:
4.5.1-dev-20221117T024619.0
npm i @capacitor/android@4.5.1-dev-20221117T024619.0
npm i @capacitor/core@4.5.1-dev-20221117T024619.0
npm i @capacitor/ios@4.5.1-dev-20221117T024619.0
On Android I now get this...
WebSocket connection to 'wss://<host>/signalrhub?id=<id>' failed: HTTP Authentication failed; no valid credentials available
(anonymous) @ WebSocketTransport.js:49
Utils.js:155 [2022-11-17T10:48:03.918Z] Information: (WebSockets transport) There was an error with the transport.
Utils.js:149
[2022-11-17T10:48:03.919Z] Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
log @ Utils.js:149
(anonymous) @ HttpConnection.js:300
notifications:246 native CapacitorHttp.request (#16338023)
notifications:246 native App.addListener (#16338024)
notifications:220 result CapacitorHttp.request (#16338023)
notifications:1
Access to resource at 'https://<host>/signalrhub?id=<id>' from origin 'http://192.168.32.85:8100' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Utils.js:149
[2022-11-17T10:48:04.120Z] Error: Failed to start the transport 'ServerSentEvents': Error: EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled.
Thanks for all of the information @WillooWisp ! Are you able to provide a project or repo for me to test against? I have a general idea of what may be causing this, but I'd like to do some further discovery & I don't have a server set up for this specific use case.
Bug Report
Capacitor Version
Platform(s)
Android (not tested on iOS yet)
Current Behavior
Using a library like SignalR from Microsoft that out of the box supports cookie authentication when performing web socket calls does not seem to work on devices, but it works in browser on PC. Before Capacitor 4.3 we got CORS problems, but now we get passed this and the problem is the authentication errors when performing the web socket calls.
Expected Behavior
Expects authenticated web socket calls to just work, since cookie should be passed on.
Code Reproduction
Other Technical Details
"@microsoft/signalr": "~6.0.9"
npm --version
output: 8.11.0yarn version
output: v1.22.19node --version
output: v16.16.0Additional Context