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

Grpc Error #10

Open
wolfmic opened this issue Jun 14, 2020 · 5 comments
Open

Grpc Error #10

wolfmic opened this issue Jun 14, 2020 · 5 comments

Comments

@wolfmic
Copy link

wolfmic commented Jun 14, 2020

I'm trying to follow the readme and I'm getting a Grpc error.

instead of

var client = new DgraphClient(new Channel("127.0.0.1:9080", ChannelCredentials.Insecure));

I'm writing

var channel = GrpcChannel.ForAddress("http://127.0.0.1:9080");
var client = new DgraphClient(channel);

Then I'm trying to alter the database without success. Is there a special grpc lib I should use?

@ahaidar-oc
Copy link

@wolfheimrick I had the same issue in dotnet core. I have it now fixed by adding the following:
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

@wolfmic
Copy link
Author

wolfmic commented Jun 19, 2020

Oh thanks, but I still get the same error. Neither the query nor the mutation succeed.

The error I get:

ExceptionalError with Message='Status(StatusCode=Internal, Detail="Error starting gRPC call: An error occurred while sending the request.")', Exception='Grpc.Core.RpcException: Status(StatusCode=Internal, Detail="Error starting gRPC call: An error occurred while sending the request.")
   at Dgraph.Transactions.ReadOnlyTransaction.<>c__DisplayClass11_0.<<QueryWithVars>b__0>d.MoveNext()        
--- End of stack trace from previous location where exception was thrown ---
   at Dgraph.DgraphClient.DgraphExecute[T](Func`2 execute, Func`2 onFail)'

@Aaronmsv
Copy link
Contributor

@wolfheimrick I'm getting the same errors and haven't found a solution yet. However, you probably still need to set the ChannelCredentials to insecure. I've made a pull request #11 to update the README.

@Aaronmsv
Copy link
Contributor

I managed to fix the error. As @ahaidar-oc mentioned, you need AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); More information can be found here: https://docs.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-3.0#call-insecure-grpc-services-with-net-core-client

Also, make sure that you are connection to the right port or you'll get that error while sending the request. The default port is 9080. I was an idiot and was using 8080.

The ChannelCredentials setting doesn't need to be set anymore it seems. It works just fine without it.

@wolfmic
Copy link
Author

wolfmic commented Jun 28, 2020

I'm gonna check that again then. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants