Graphql-engine: CLI console subscriptions connect via WS instead of WSS on HTTPS/WSS Endpoints

Created on 4 Jun 2019  路  6Comments  路  Source: hasura/graphql-engine

I have a hasura server running behind Traefik and configured to require HTTPS/WSS connections. In Chrome the console works correctly, in Safari queries and mutations work but subscriptions don't connect.

console bug urgent

Most helpful comment

Yeah the error is the 301 because it is connecting to ws:// instead of wss://

WebSocket connection to 'ws://graphql.xxx/v1/graphql' failed: Unexpected response code: 301

All 6 comments

@respectTheCode do you see any error in the network tab (of developer console) ? Can you paste the error if any?

Yeah the error is the 301 because it is connecting to ws:// instead of wss://

WebSocket connection to 'ws://graphql.xxx/v1/graphql' failed: Unexpected response code: 301

@respectTheCode We could not reproduce this on our end. The calls via Safari seem to be being made with the wss protocol as expected. Can you confirm if your GraphQL API endpoint is also https

Screenshot from 2019-06-11 14-49-54

The endpoint is https but it looks like both chrome and safari are connecting to ws://. The difference appears to be that chrome is following the 301 redirect and safari is not.

I am starting the client with hasura console --endpoint https://graphql...

image

@respectTheCode Thanks for the extra information. I could reproduce this on the CLI console. We'll fix this soon.

Expected behaviour:
If GraphQL endpoint is http, protocols used should be http / ws
If GraphQL endpoint is https, protocols used should be https / wss

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lishine picture lishine  路  3Comments

hooopo picture hooopo  路  3Comments

sachaarbonel picture sachaarbonel  路  3Comments

cpursley picture cpursley  路  3Comments

jjangga0214 picture jjangga0214  路  3Comments