pydgraph icon indicating copy to clipboard operation
pydgraph copied to clipboard

Report clear and useful error when using non-cloud client against Dgraph Cloud

Open damonfeldman opened this issue 1 year ago • 2 comments

Have you tried Pydgraph before this proposal? and did not find anything similar?

None

What you wanted to do.

Get clear error when connecting incorrectly to a cloud endpoint.

For the below situation, the error could be prefixed with

Unable to connect. If this is a Dgraph Cloud endpoint, please connect using ' pydgraph.DgraphClientStub.from_cloud'

What you actually did.

Tried to connect to Dgraph Cloud via


client_stub = pydgraph.DgraphClientStub('[zzzzzzzzz.grpc.us-west-2.aws.cloud.dgraph.io:443](http://zzzzzzzz.grpc.us-west-2.aws.cloud.dgraph.io:443/)')
client = pydgraph.DgraphClient(client_stub)
client.login_into_namespace("abcdabcd", "xxxxxxx", 1)

Why wasn't it great, with examples.

When trying to connect to gRPC from the cloud env - getting error message:

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses; last error: INTERNAL: ipv4:xx.xx.xx.xx:443: Trying to connect an http1.x server"
debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: INTERNAL: ipv4:4xx.xx.xx.xx:443: Trying to connect an http1.x server {created_time:"2023-08-30T12:31:18.393056+10:00", grpc_status:14}"

Additional information.

This is because the from_cloud() method with an api key is needed as in


client_stub = pydgraph.DgraphClientStub.from_cloud("https://xxxxxxxx.eu-central-1.aws.cloud.dgraph.io/graphql", "<api-key>")
client = pydgraph.DgraphClient(client_stub) 

damonfeldman avatar Aug 30 '23 13:08 damonfeldman

Issue was closed by error but reopened.

rarvikar avatar Aug 30 '23 13:08 rarvikar

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

github-actions[bot] avatar Jul 11 '24 01:07 github-actions[bot]