ParticulaCode / FoundryVTT-GoDice

MIT License
2 stars 6 forks source link

TypeError: undefined. Cannot read properties of undefined (reading 'connection') #3

Closed myzar472 closed 1 year ago

myzar472 commented 1 year ago

Running the latest V11 FoundryVTT build 302 with a set of GoDice. An error is thrown in developer console running Chromium. The GoDice Companion prompt window appears fine, but no dice results appear.

The error is as follows on a brand new world with no modules except Unfulfilled Rolls and GoDice. image

TypeError: An error occurred while rendering GodiceResolver 49. Cannot read properties of undefined (reading 'connection')
    at GodiceResolver.activateListeners (godice-resolver.js:93:30)
    at GodiceResolver._render (foundry.js:5800:10)
    at async GodiceResolver._render (foundry.js:6488:5)
onError @ foundry.js:753

image

My phone is running Android and showing a websocket below (ws://192.168.1.147:8596), and laptop is on OSX running on WiFi on the same network as the phone. The phone is able to communicate with the dice.

myzar472 commented 1 year ago

This issue is SSL related. I am running FoundryVTT behind a Reverse Proxy on nginx, meaning I need a secure web socket (WSS)

The error is: dice-connection.mjs:22 Mixed Content: The page at '***/foundry/game' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://192.168.1.147:8596/FoundryGDVTT'. This request has been blocked; this endpoint must be available over WSS.

Setting wss instead of ws within Settings lets it connect, but connections automatically close.

Please add SSL support to GoDice!

Anchor8900 commented 1 year ago

Try going to the Page Setting under the pad lock on the address bar and change Insecure Content to ALLOW. Cleared that error for me...

myzar472 commented 1 year ago

Try going to the Page Setting under the pad lock on the address bar and change Insecure Content to ALLOW. Cleared that error for me...

I presume you have an invalid certificate and you suspect that's why this error is occurring.

Allowing insecure content will not work if you have a good SSL certificate as the SSL is already secure to begin with. It will be using SSL/TLS properly instead of forcing it to allow non SSL/TLS over SSL/TLS.

In my case, I have nothing to allow as it isn't insecure - i have a reverse proxy with a proper certificate, but folks with a proper SSL certificate in Foundry would have the same issue. Because of that, we need Secure Web Socket (WSS)

image

AKparticula commented 1 year ago

Thanks @myzar472 ! We are already working on enabling WSS through the GoDice app, and hope to provide it as soon as it'll work for us.

AKparticula commented 1 year ago

Closing this issue as this is related to the SSL issue. We are working on an app update to allow SSL. Stay tuned.