grpc-node: request failure using the pure js server code

Problem description

I’m seeing silent failures when using the pure js implementation but the grpc package works fine.

Reproduction steps

I’m writing an authentication plugin to work with envoy (https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/auth/v3/external_auth.proto). I have a local client I used to invoke the service locally (using the pure js code) and that works just fine. However when the service is invoked by envoy itself I get silent failures (callback is never invoked, connection is showing as reset on the envoy side). After scratching my head for far too long I decided to try the the c-based package and immediately it worked successfully.

Environment

  • OS name, version and architecture: arch
  • Node version 12
  • Node installation method pacman
  • Package name and version [e.g. gRPC@1.12.0]
    "@grpc/grpc-js": "^1.3.2",
    "grpc": "^1.24.10",

Additional context

tcpdump appeared to show the pure js package responding at least to a HEAD request coming from envoy (something my local client doesn’t do) but for some reason I’m not getting much more than that.

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (15 by maintainers)

Most upvoted comments

The document I linked is an official specification of gRPC behavior, and as far as I know, all of the official libraries, including the one for Go, are implemented in accordance with it.

I want to comment on something you mentioned in the Node issue:

@grpc/grpc-js should probably default to adding unix:// to the server/client when the path looks like a uds (or does not look like a host:port). maybe this should be left to higher-level code?

We intentionally do not do this. We don’t have any complex heuristics at all when handling target addresses. We just default to DNS, which is the behavior specified in this document:

The URI scheme indicates what resolver plugin to use. If no scheme prefix is specified or the scheme is unknown, the dns scheme is used by default.

You’re right, that package does not have UDS support.

The node grpc version being deprecated while this issue still exists is disheartening. Are there other avenues/channels we should be looking to get a fix?

I have 2 projects using grpc and neither of them can be fully migrated unfortunately still:

  • integration with envoy due to this issue
  • csi driver for k8s/Nomad/etc because of unix socket bind issues and/or screwy authentication issues (the later more the problem of bad clients, but nonetheless)

OK, I have posted nodejs/help#3422. Hopefully we can get some information from there to help understand this bug better.