hi! I'm trying to use <dagster-graphql> but it doe...
# ask-community
a
hi! I'm trying to use dagster-graphql but it does not allow me to init the client.
Copy code
from dagster_graphql import DagsterGraphQLClient
client = DagsterGraphQLClient(hostname="localhost", port_number=3000, use_https=True)
Error:
{DagsterGraphQLClientError}Error when connecting to url https://localhost:3000/graphql. Did you specify hostname: localhost and port_number: 3000 correctly?
I'm using ssh connection to an instance and then connect to Dagit via localhost:
ssh -N -L 3000:<uri>:3000 <username>@<instance_id>
I can successfully open https://localhost:3000/graphql in browser and in Postman (although I had to disable SSL validation in Postman). I'm assuming I get SSL validation error in the code as well but I don't know how to handle it in PyCharm. Thanks in advance for assistance.
p
Hi Andriy. Do you run into the same issues when running the client with the default
use_https=False
?
a
hi prha, in case with use_https=False I’m getting 400 Bad request
{HTTPError}400 Client Error: Bad Request for url: <http://localhost:3000/graphql>
@prha any ideas what could be wrong? I'll appreciate any help
p
Hmm… Are you instantiating the client locally or from within your SSH session? We’re using the https://github.com/graphql-python/gql/blob/master/gql/transport/requests.py to manage the graphql requests to the endpoint, which is just using the
requests
library under the hood.
a
I'm instantiating it from within the SSH session (using localhost as a host with port forwarding to the actual dagster host)