question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Port not included in authority, leading to routing failures

See original GitHub issue

Problem description

Essentially, this looks the same as this issue: https://github.com/grpc/grpc-go/issues/1120

In this case, @grpc/grpc-js doesn’t include the port in the authority when making requests. If you’re in an environment that uses the authority for routing (for example, Linkerd2), then routing will fail as the sidecar will proxy to port 80 (well, will fail unless your gRPC server is using port 80).

The grpc node package doesn’t suffer from this issue, and does include the port number, I’ve currently reverted to using that (but nice work on making that a very easy transition!)

Reproduction steps

  • Use @grpc/grpc-js to make a request to a gRPC service.
  • Observe the authority doesn’t include the port.

You could also specifically try to deploy a @grpc/grpc-js application into Kubernetes with Linkerd2, then try to make a request to a gRPC service from a @grpc/grpc-js client, it should fail.

For comparison, here’s what $ linkerd tap looks like for the gRPC client application:

With grpc:

req id=0:2 proxy=out src=172.30.0.16:48814 dst=172.30.0.18:50051 tls=true :method=POST :authority=client.default.svc.cluster.local:50051 :path=/namespace.Service/Method
rsp id=0:2 proxy=out src=172.30.0.16:48814 dst=172.30.0.18:50051 tls=true :status=200 latency=22078µs
end id=0:2 proxy=out src=172.30.0.16:48814 dst=172.30.0.18:50051 tls=true grpc-status=OK duration=76µs response-length=89B

With @grpc/grpc-js:

req id=0:1 proxy=out src=172.30.7.39:49006 dst=172.30.1.10:80 tls=true :method=POST :authority=client.default.svc.cluster.local :path=/namespace.Service/Method
rsp id=0:1 proxy=out src=172.30.7.39:49006 dst=172.30.1.10:80 tls=true :status=200 latency=37035µs
end id=0:1 proxy=out src=172.30.7.39:49006 dst=172.30.1.10:80 tls=true grpc-status=Unavailable duration=28µs response-length=0B

Environment

  • OS name, version and architecture: Linux x64 (Google, GKE, 1.16)
  • Node version: v12.18.0
  • Node installation method: Docker image (erbium-alpine)
  • Package name and version: @grpc/grpc-js v1.0.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
murgatroid99commented, Jun 18, 2020

That fix is out in version 1.1.0.

1reaction
murgatroid99commented, Jun 16, 2020

I think I have found the problem. grpc-js uses the same string for the :authority header and the host part of the service_url passed to credentials callbacks. grpc keeps the port in the former, and omits it from the latter. The issue I linked as about a credentials error, so I think that was the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SBC connectivity issues - Microsoft Teams
An SBC is not configured correctly for Direct Routing. This article lists some common issues that are related to SIP options and TLS ......
Read more >
Troubleshoot Switch Port and Interface Problems - Cisco
This document describes how to determine why a port or interface experiences problems.
Read more >
Guidelines on firewalls and firewall policy - GovInfo
The following items summarize the major recommendations from this section: ▫ The use of NAT should be considered a form of routing, not...
Read more >
Troubleshooting a DHCP server failure - TechTarget
The most common reasons for this error include DHCP server failure, no available addresses and network failure. Error 1. No address assigned. The...
Read more >
Switch Port View - Cisco Meraki
Port Overview · PoE overload: connected device is consuming more power than the maximum limit configured or specified in the 802.3at/af standards.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found