-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Working from the helloworld example but getting an error on HTTP requests: grpc: the client connection is closing. Would like to improve the docs. #1924
Comments
Hi @seantcanavan, thanks for your interest in the project! We've recently released a new tutorial series that should set you up with a basic grpc-gateway from scratch: https://grpc-ecosystem.github.io/grpc-gateway/docs/tutorials/introduction/. Could you try walking through this and see if that sets you up successfully? Your error is indicative of the grpc-gateway client not being able to connect to the grpc server. I would recommend scrapping what you have in main and basing it off the tutorial or the boilerplate repo (https://github.com/johanbrandhorst/grpc-gateway-boilerplate). A quick skim through the code doesn't reveal anything obvious, but the way you're running things inside goroutines in main is a bit unusual anyway. Let me know if you think the tutorial or docs could be improved still! |
Thanks Johan I'll dig into that. Pretty rough running into an error in the first line of the doc but I've opened a PR to try to update the documentation #1929 |
Hey @johanbrandhorst, I started from scratch and the updated instructions have produced a working example on my local. The new |
Glad to hear it, I work at Buf 😁. |
I got the same error, but sometimes it works and I dont know why. Even in a same execution, it could be ok or error when request multiple times |
I think it has something to do with the context handling
|
@e7 if it helps I took all the knowledge I gained working through the sample code here to come up with my own sample? starter? I'll let you decide. It's a barebones out-of-the-box fully documented working grpc gateway example: https://github.com/seantcanavan/minimal-go-grpc-gateway-example |
I just ran into the same issue. It's because the the defer cancel, as the http service is started in a go routine. The defer cancel gets called and stops the http service. Simply removing the defer cancel call will resolve the issue.
|
If this is still present in the example, please submit a PR to fix it, thanks! |
I'm a huge fan of the library and I've been hard at work for over a week trying to massage the docs into something that compiles, runs, and works. I feel I'm extremely close because my GRPC requests successfully return but my HTTP GET requests return 408 apparently?
http curl output:
the guts of server/main.go:
helloworld/greeter_server.go:
client/main.go:
Any ideas would be great and once I get everything working I can update the code in
examples/helloworld
.The text was updated successfully, but these errors were encountered: