grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Unable To Make gRPC Calls From NodeJS

Open bonedaddy opened this issue 6 years ago • 1 comments

Update-1: I decided to try running my grpc server behid the grpcwebproxy service and have made SOME progress but I'm still getting errors.

Logs from the grpcwebproxy service:

WARN[0002] finished streaming call with code Unavailable  error="rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection closed" grpc.code=Unavailable grpc.method=DagPut grpc.service=pb.DagAPI grpc.start_time="2019-11-12T22:54:22Z" grpc.time_ms=0.294 span.kind=server system=grpc
WARN[0002] finished streaming call with code Unavailable  error="rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection closed" grpc.code=Unavailable grpc.method=Status grpc.service=pb.StatusAPI grpc.start_time="2019-11-12T22:54:22Z" grpc.time_ms=0.32 span.kind=server system=grpc

Logs from running node sdk.js:

hit an error 14 all SubConns are in TransientFailure, latest connection error: connection closed e {
  headersMap:
   { 'access-control-expose-headers':
      [ 'Date, Content-Type, Grpc-Status, Grpc-Message, Vary, grpc-status, grpc-message' ],
     'content-type': [ 'application/grpc-web+proto' ],
     'grpc-message':
      [ 'all SubConns are in TransientFailure, latest connection error: connection closed' ],
     'grpc-status': [ '14' ],
     vary: [ 'Origin' ],
     connection: [ 'close' ],
     'transfer-encoding': [ 'chunked' ] } }
hit an error 14 all SubConns are in TransientFailure, latest connection error: connection closed e {
  headersMap:
   { 'access-control-expose-headers':
      [ 'Date, Content-Type, Grpc-Status, Vary, Grpc-Message, grpc-status, grpc-message' ],
     'content-type': [ 'application/grpc-web+proto' ],
     'grpc-message':
      [ 'all SubConns are in TransientFailure, latest connection error: connection closed' ],
     'grpc-status': [ '14' ],
     vary: [ 'Origin' ],
     connection: [ 'close' ],
     'transfer-encoding': [ 'chunked' ] } }

Additionally something strange I noticed, these requests dont appear to make it to my backend grpc server. They got intercepted by the grpcwebproxy service and thats it.

Versions of relevant software used From npm package.json

  "dependencies": {
    "@improbable-eng/grpc-web": "^0.11.0",
    "@improbable-eng/grpc-web-node-http-transport": "^0.11.0",
    "google-protobuf": "^3.10.0"
  }

What happened When making a request no requests appear to be made and instead the program hangs

What you expected to happen Requests to be made successfully and information printed to console

How to reproduce it (as minimally and precisely as possible): Run the following script https://github.com/RTradeLtd/TxPB/blob/screipt/script/sdk.ts

Full logs to relevant components

solidity@dark:~/Code/RTradeLtd/TxPB/script$ node sdk.js
hit an error 2 Response closed without headers e { headersMap: {} }
hit an error 2 Response closed without headers e { headersMap: {} }

Anything else we need to know

Environment: OS:

NAME="Pop!_OS"
VERSION="19.10"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Pop!_OS 19.10"
VERSION_ID="19.10"
HOME_URL="https://system76.com/pop"
SUPPORT_URL="http://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=eoan
UBUNTU_CODENAME=eoan
LOGO=distributor-logo-pop-os

Kernel

Linux dark 5.3.0-20-generic #21+system76~1572304854~19.10~8caa3e6-Ubuntu SMP Tue Oct 29 00:486_64 x86_64 x86_64 GNU/Linux

Node Version

v10.17.0

NPM Version

6.13.0

bonedaddy avatar Nov 12 '19 20:11 bonedaddy

Same here with the most recent version :(

romnn avatar Jun 14 '22 01:06 romnn