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

Can't load debug build over https (upgrade websocket to secure) #2435

Open
jhaglund opened this issue May 16, 2024 · 2 comments
Open

Can't load debug build over https (upgrade websocket to secure) #2435

jhaglund opened this issue May 16, 2024 · 2 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures package:dwds triaged

Comments

@jhaglund
Copy link

jhaglund commented May 16, 2024

The debug builds use insecure websockets to communicate with the debugger. I setup an nginx proxy to serve my build over https, to enable APIs to set secure cookies.

Serving the page over https means insecure protocols are not allowed but the debugger is connecting to ws:// insecure websockets, crashing the app and causing the loading bar to run forever.

The browser error message is:
The page at 'https://site.local/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://site.local:44444/$dwdsSseHandler'. This request has been blocked; this endpoint must be available over WSS.

If supporting WSS is too much (because of certificates or something), could we get an argument to configure the debugger endpoint like:
--debug-dart-url wss://site.local/$dwdsSseHandler

I would then configure nginx proxy wss://site.local requests to ws://site.local:44444

@jhaglund
Copy link
Author

jhaglund commented May 16, 2024

In addition to the browser's native error there was this error

Unhandled error detected in the injected client.js script.

You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.

The original error is below, please file an issue at
https://github.com/dart-lang/webdev/issues/new and attach this output:

SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
Error: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
    at Object.HtmlWebSocketChannel$connect (https://site.local/dwds/src/injected/client.js:9617:19)
    at https://site.local/dwds/src/injected/client.js:25846:106
    at _wrapJsFunctionForAsync_closure.$protected (https://site.local/dwds/src/injected/client.js:4049:15)
    at _wrapJsFunctionForAsync_closure.call$2 (https://site.local/dwds/src/injected/client.js:12422:12)
    at Object._asyncStartSync (https://site.local/dwds/src/injected/client.js:4013:20)
    at main_closure.call$0 (https://site.local/dwds/src/injected/client.js:25904:16)
    at StaticClosure._rootRun (https://site.local/dwds/src/injected/client.js:4416:16)
    at _CustomZone.run$1$1 (https://site.local/dwds/src/injected/client.js:13809:39)
    at Object.runZonedGuarded (https://site.local/dwds/src/injected/client.js:4527:88)
    at main (https://site.local/dwds/src/injected/client.js:9675:16)
    at https://site.local/dwds/src/injected/client.js:27966:7
    at https://site.local/dwds/src/injected/client.js:27949:7
    at dartProgram (https://site.local/dwds/src/injected/client.js:27960:5)
    at https://site.local/dwds/src/injected/client.js:27968:3


@jmiller-pwi
Copy link

Experiencing this issue as well. See related #2444

@bkonyi bkonyi added P1 A high priority bug; for example, a single project is unusable or has many test failures triaged package:dwds labels Jul 31, 2024
@bkonyi bkonyi self-assigned this Jul 31, 2024
@bkonyi bkonyi assigned jyameo and unassigned bkonyi Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures package:dwds triaged
Projects
None yet
Development

No branches or pull requests

4 participants