Repository navigation
feat(napi): expose HTTP proxy + per-connection socket timeout ConnectionOptions - #129
Merged
Merged
Conversation
msrathore-db
force-pushed
the
msrathore/krn-napi-proxy-socket-timeout
branch
2 times, most recently
from
June 5, 2026 13:37
2d5a418 to
c55bb28
Compare
msrathore-db
force-pushed
the
msrathore/krn-napi-proxy-socket-timeout
branch
from
June 10, 2026 07:18
c55bb28 to
2e030c8
Compare
msrathore-db
had a problem deploying
to
azure-prod
June 10, 2026 07:18 — with
GitHub Actions
Failure
msrathore-db
force-pushed
the
msrathore/krn-napi-proxy-socket-timeout
branch
from
June 10, 2026 09:00
2e030c8 to
f06fd34
Compare
msrathore-db
had a problem deploying
to
azure-prod
June 10, 2026 09:00 — with
GitHub Actions
Failure
…ionOptions Add two new optional napi `ConnectionOptions` fields so the Node SEA driver can configure HTTP routing programmatically instead of relying solely on the `HTTPS_PROXY` env var: - `proxy`: an HTTP/HTTPS proxy URL (e.g. `http://user:pass@host:port`) routed through `reqwest::Proxy::all`. Embedded basic-auth credentials are honoured. Omitted => current behaviour (env vars still respected). - `socketTimeoutMs`: per-connection read timeout mapped onto the kernel `HttpConfig::request_timeout` (reqwest `Client::timeout`). Plumbing: - Give the public `config::ProxyConfig` real fields (url / username / password / bypass_hosts) with a redacting `Debug`, replacing the previously-empty reserved struct. - Project `SessionConfig.proxy` onto the internal `HttpClientConfig` proxy in `build_proxy_config` (the internal http layer already supported proxy URL/auth/bypass; only the public->internal wiring was missing). Keep a destructuring binding so future field additions fail to compile rather than being silently dropped. The internal `reqwest::ClientBuilder` proxy/timeout handling is unchanged. Adds unit tests for the proxy projection and the request_timeout -> read_timeout mapping. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
msrathore-db
force-pushed
the
msrathore/krn-napi-proxy-socket-timeout
branch
from
June 10, 2026 09:10
f06fd34 to
3e04601
Compare
msrathore-db
had a problem deploying
to
azure-prod
June 10, 2026 09:10 — with
GitHub Actions
Failure
…d inline wait)
The two `execute_direct_*_running_*` e2e tests asserted a `range(40e9)` scan
(~35s on the test warehouse) comes back `Running`. But `execute_direct` omits
`wait_timeout`, so the SEA server applies its default inline wait — which holds
far longer than the "~10s" an earlier comment assumed (up to the 50s SEA max).
A ~35s scan therefore sits right at that boundary and intermittently returns
`Completed`, panicking ("a 40B-row scan must be Running").
`rand()` makes the query non-cacheable (consecutive runs return different
counts), so a larger `range()` is genuinely proportionally slower — it cannot
be short-circuited by any result/IO cache:
- cancellable test: `range(1e12)` — cannot finish within ANY inline wait, so
Running is deterministic; it is cancelled, so the full scan never runs.
- await-result test: `range(100e9)` (~90s) — clears the inline-wait ceiling
with comfortable margin while `await_result` still completes in bounded time.
Verified locally: both return `Running` and pass.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
msrathore-db
had a problem deploying
to
azure-prod
June 10, 2026 09:31 — with
GitHub Actions
Failure
vikrantpuppala
approved these changes
Jun 10, 2026
`custom_http_headers_round_trip_succeeds` passed a made-up
`KernelE2E/1.0` User-Agent. Since a caller UA now REPLACES the kernel's
base UA (the JDBC prefix is no longer retained), and the SEA gateway
gates the INLINE_OR_EXTERNAL_LINKS result disposition on a `startsWith`
match against its allow-list of known driver prefixes, a non-allow-listed
prefix is rejected with HTTP 400 ("not a supported disposition").
Use the real Node connector prefix (`NodejsDatabricksSqlConnector/...`),
the way the NodeJS driver forwards its composed UA over napi. This both
makes the smoke test reflect real driver behaviour and confirms the
prefix is allow-listed for the disposition gate.
Verified against the live workspace: passes.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
msrathore-db
added a commit
to databricks/databricks-sql-nodejs
that referenced
this pull request
Jun 10, 2026
…n on the kernel backend
Map the public Thrift-shaped `ConnectionOptions.proxy`
(`{protocol, host, port, auth}`) onto the kernel napi binding's
`proxy?: string`, so the SAME proxy connection option that works on the
Thrift backend now also routes kernel/SEA traffic through a proxy.
`buildKernelProxyOptions` composes `protocol://[user:pass@]host:port`,
percent-encoding any `auth.{username,password}` into the URL userinfo so
credentials with reserved characters survive; the kernel parses the
userinfo off and applies it as proxy basic-auth. Wired into
`buildKernelConnectionOptions` alongside the TLS / HTTP option builders.
The regenerated napi contract (`native/kernel/index.d.ts`) carries the
new `proxy?: string` and `socketTimeoutMs?: number` fields exposed by the
kernel PR (databricks/databricks-sql-kernel#129).
Note: env-var proxying (`HTTPS_PROXY` / `HTTP_PROXY` / `NO_PROXY`) already
worked on the kernel backend (reqwest honours it natively); this adds the
*programmatic* path for callers who cannot set process env vars.
Verified end-to-end via mitmproxy against a live serverless warehouse:
explicit `proxy` option (no env var) routes all SEA calls through the
proxy; a dead proxy port fails the connection (proving the proxy is used).
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two optional
ConnectionOptionsfields to the napi binding so a Node caller can configure HTTP routing programmatically, not just via env vars:proxy?: string— an HTTP/HTTPS proxy URL (e.g.http://user:pass@host:port). Wired toreqwest::Proxy::all(url); basic-auth credentials embedded in the URLuserinfoare honoured. Setting it routes all kernel traffic (session create, statement submit/poll, CloudFetch, close) through the proxy for that connection.socketTimeoutMs?: number— per-connection read timeout (ms), mapped ontoHttpConfig::request_timeout(reqwest'sClient::timeout). Omitted ⇒ kernel default (120 s).Why this is needed (and what already worked)
The kernel's internal
client/http.rsproxy plumbing (Proxy::all+basic_auth+NoProxybypass) was already complete, and env-var proxying already works — reqwest honoursHTTPS_PROXY/HTTP_PROXY/NO_PROXYnatively (it is not gated bydefault-features), andhttp.rsnever calls.no_proxy(). The only gap was the public→internal bridge:config::ProxyConfigwas an empty#[non_exhaustive]stub, so neither binding could pass an explicit proxy. This PR fills the publicProxyConfig(url / username / password / bypass_hosts, with a password-redactingDebug), projects it onto the internalHttpProxyConfiginbuild_proxy_config, and exposes it through napiConnectionOptions. Whenproxyis unset, behaviour is unchanged and the env vars are still honoured.This gives the Node driver Thrift-parity: the same
ConnectionOptions.proxythat works on the Thrift backend now also works on the kernel/SEA backend.Verification
cargo test(full, incl. doc tests) — 653 lib + proxy-projection tests pass, 0 failed;cargo clippy --all-targets -- -D warningsclean (lib + napi);cargo +stable fmt --allclean.napi/index.d.tscarriesproxy?: string+socketTimeoutMs?: number.useKernel: trueagainst a live serverless SQL warehouse):proxyoption (no env var) → all SEA calls (POST /sessions,POST /statements,GET …,DELETE …) intercepted by mitmproxy;SELECTreturns the expected row.HTTPS_PROXYenv var (no explicit option) → also intercepted (confirms the env path still works).Rebased onto current
main.This pull request and its description were written by Isaac.