grpc-js: secure channel to an IP address fails on Node 25+ (servername set to IP literal)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- grpc, node.js, typescript
調査の方向性
channel-credentials.ts の getConnectionOptions から始め、次に SecureConnectorImpl.connect が tls.connect のエラーをどのように処理するか確認してください。issue の再現例では、IP を宛先にした場合は失敗し、ホスト名を宛先にした場合は成功します。Node 26 でその再現例を使って動作を確認してください。IP リテラルを servername として渡さずに IP 宛先へ接続でき、ホスト名宛先への接続も引き続き成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem description
Credentials from createSsl() cannot connect to a target given by IP address on Node 25 and later.
getConnectionOptions in channel-credentials.ts sets servername = remoteHost unconditionally (since #1466). Node 25 made DEP0123 End-of-Life (nodejs/node#58533), so tls.connect now throws instead of warning when servername is an IP literal:
ERR_INVALID_ARG_VALUE: The property 'options.servername' Setting the TLS ServerName to an IP address is not permitted.. Received '127.0.0.1'
The throw happens inside the connect promise in SecureConnectorImpl.connect, so the caller only ever sees 14 UNAVAILABLE: No connection established. Hostname targets work. Node 26 is the current LTS, so this now hits default installs.
Reproduction steps
Any TLS gRPC server listening on 127.0.0.1:PORT, then:
const grpc = require('@grpc/grpc-js');
const client = new grpc.Client('127.0.0.1:PORT',
grpc.credentials.createSsl(null, null, null, { rejectUnauthorized: false }));
client.waitForReady(Date.now() + 2000, err => console.log(err ? err.message : 'connected'));
Node 24: connected
Node 26: Failed to connect before the deadline
Wrapping tls.connect to log its options shows servername: '127.0.0.1' on every attempt, and the synchronous ERR_INVALID_ARG_VALUE throw.
Environment
- Linux 7.0, amd64
- Node v26.13.0 (works on v24.17.0)
- fnm
- @grpc/grpc-js 1.14.7, same code on master
Additional context
Node's own https agent already skips SNI for IP literals. Same one-line change here:
if (!net.isIP(remoteHost)) {
connectionOptions.servername = remoteHost;
}
- 主要言語
- TypeScript
- スター
- 4.8k
- フォーク
- 720
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
grpc/grpc-node のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
grpc/grpc-node#3112 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
CompressionFilter’s IdentityHandler.writeMessage calls Buffer-only .copy() on caller-provided message対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
package: @grpc/grpc-js
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
grpc/grpc-node#2993 · コメント 3 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-javascript#26203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytedance/flowgram.ai#1235 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
devswha/herdr-web-ui#3325 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100