fix(prestodb-driver): Send custom headers on nextUri poll requests#11037
Conversation
The upstream presto-client only applies custom headers to the initial POST /v1/statement request. The follow-up nextUri GET polls (and the cancel/kill/node requests) were issued with an empty header set, so custom headers required by a proxy/gateway in front of Presto/Trino (e.g. Proxy-Authorization) were dropped after the first request, causing the query to fail with "User authentication failed". Wrap client.request so the configured custom headers are applied to every request, while preserving the upstream nextUri host-following behaviour. Also split the driver tests into test/unit and test/integration folders and add a `unit` script, matching the trino-driver convention.
|
Claude finished @ovr's task in 1m 8s —— View job Code reviewVerdict: Looks good overall — targeted fix, clear rationale, real regression coverage. A few notes below; nothing blocking. Details — 0 high, 2 medium, 2 lowChecklist
Medium
opts.headers = { ...customHeaders, ...(opts.headers || {}) };This mutates the object passed in by the caller (the upstream
view.port = href.port || (href.protocol === 'https:' ? '443' : '80');
view.protocol = href.protocol;The upstream Low
const originalRequest = client.request;
client.request = function patchedRequest(opts, callback) { ... }
Nits / praise
|
|
Claude finished @ovr's task in 31s —— View job Code review (re-run on sync)Verdict: No code changes since the previous review — the new commit is a Details — 0 high, 2 medium, 2 low (unchanged from prior review)Checklist
Medium
opts.headers = { ...customHeaders, ...(opts.headers || {}) };Assigns a new object to
view.port = href.port || (href.protocol === 'https:' ? '443' : '80');
view.protocol = href.protocol;Upstream Low
Nits / praise
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11037 +/- ##
===========================================
- Coverage 78.78% 58.51% -20.28%
===========================================
Files 471 216 -255
Lines 94509 17265 -77244
Branches 3520 3524 +4
===========================================
- Hits 74463 10102 -64361
+ Misses 19538 6648 -12890
- Partials 508 515 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The upstream presto-client only applies custom headers to the initial POST /v1/statement request. The follow-up nextUri GET polls (and the cancel/kill/node requests) were issued with an empty header set, so custom headers required by a proxy/gateway in front of Presto/Trino (e.g. Proxy-Authorization) were dropped after the first request, causing the query to fail with "User authentication failed".
Wrap client.request so the configured custom headers are applied to every request, while preserving the upstream nextUri host-following behaviour.
Also split the driver tests into test/unit and test/integration folders and add a
unitscript, matching the trino-driver convention.