improbable-eng / grpc-web

gRPC Web implementation for Golang and TypeScript
Apache License 2.0
4.39k stars 435 forks source link

500 error #338

Closed ghost closed 5 years ago

ghost commented 5 years ago
https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld

setup1 node server.js setup2 ./grpcwebproxy --backend_addr=localhost:9090 --run_tls_server=FALSE

setup3 protoc -I=. helloworld.proto --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.

setup4: node_modules/.bin/webpack client.js

setup5: chrome file:///home/orange/work/go/grpc-web/examples/helloworld/index.html

console error: main.js:8 POST http://localhost:8080/helloworld.Greeter/SayHello 500 (Internal Server Error) goog.net.XhrIo.send @ main.js:8 module$contents$grpc$web$GrpcWebClientBase_GrpcWebClientBase.rpcCall @ main.js:8 n.helloworld.GreeterClient.sayHello @ main.js:8 (anonymous) @ main.js:1 o @ main.js:1 (anonymous) @ main.js:1 (anonymous) @ main.js:1 main.js:1 Uncaught TypeError: Cannot read property 'getMessage' of null at i.sayHello (main.js:1) at module$contents$grpc$web$GrpcWebClientReadableStreamGrpcWebClientReadableStream.onErrorCallback (main.js:8) at goog.net.XhrIo. (main.js:8) at goog.net.XhrIo.goog.events.EventTarget.fireListeners (main.js:8) at Function.goog.events.EventTarget.dispatchEventInternal (main.js:8) at goog.net.XhrIo.goog.events.EventTarget.dispatchEvent (main.js:8) at goog.net.XhrIo.dispatchErrors (main.js:8) at goog.net.XhrIo.onReadyStateChangeHelper (main.js:8) at goog.net.XhrIo.onReadyStateChangeEntryPoint (main.js:8) at goog.net.XhrIo.onReadyStateChange (main.js:8) i.sayHello @ main.js:1 (anonymous) @ main.js:8 (anonymous) @ main.js:8 goog.events.EventTarget.fireListeners @ main.js:8 goog.events.EventTarget.dispatchEventInternal @ main.js:8 goog.events.EventTarget.dispatchEvent @ main.js:8 goog.net.XhrIo.dispatchErrors @ main.js:8 goog.net.XhrIo.onReadyStateChangeHelper @ main.js:8 goog.net.XhrIo.onReadyStateChangeEntryPoint @ main.js:8 goog.net.XhrIo.onReadyStateChange @ main.js:8 XMLHttpRequest.send (async) goog.net.XhrIo.send @ main.js:8 module$contents$grpc$web$GrpcWebClientBase_GrpcWebClientBase.rpcCall @ main.js:8 n.helloworld.GreeterClient.sayHello @ main.js:8 (anonymous) @ main.js:1 o @ main.js:1 (anonymous) @ main.js:1 (anonymous) @ main.js:1 main.js:8 POST http://localhost:8080/helloworld.Greeter/SayRepeatHello 500 (Internal Server Error) goog.net.XhrIo.send @ main.js:8 module$contents$grpc$web$GrpcWebClientBase_GrpcWebClientBase.serverStreaming @ main.js:8 n.helloworld.GreeterClient.sayRepeatHello @ main.js:8 (anonymous) @ main.js:1 o @ main.js:1 (anonymous) @ main.js:1 (anonymous) @ main.js:1 main.js:8 POST http://localhost:8080/helloworld.Greeter/SayHelloAfterDelay 500 (Internal Server Error) goog.net.XhrIo.send @ main.js:8 module$contents$grpc$web$GrpcWebClientBase_GrpcWebClientBase.rpcCall @ main.js:8 n.helloworld.GreeterClient.sayHelloAfterDelay @ main.js:8 (anonymous) @ main.js:1 o @ main.js:1 (anonymous) @ main.js:1 (anonymous) @ main.js:1 main.js:1 Got error, code = 14, message = Http response at 400 or 500 level

You look setup2. I feel it is the problem of proxy grpcwebproxy

johanbrandhorst commented 5 years ago

Still looks like a duplicate of https://github.com/improbable-eng/grpc-web/issues/109, and I don't appreciate you circumventing the issue tracker by creating a duplicate of #336. Have you tried using this repo's client instead?