Skip to content

fix(sdk-rtl): apply the timeout AbortSignal and stop logging a bogus "not defined" message - #1742

Draft
kaldav wants to merge 1 commit into
looker-open-source:mainfrom
kaldav:fix/base-transport-timeout-signal
Draft

kaldav wants to merge 1 commit into
looker-open-source:mainfrom
kaldav:fix/base-transport-timeout-signal

Conversation

@kaldav

@kaldav kaldav commented Sep 9, 2026 •

Copy link
Copy Markdown

What this fixes

BaseTransport.initRequest builds an AbortSignal for every request, but two bugs in the same block mean it never reaches fetch and it logs a misleading message on every call:

  1. Shadowed variable. The inner let signaller = AbortSignal.timeout(ms) declares a new variable instead of assigning the outer one, so the outer signaller stays undefined and props.signal is always undefined. In practice, no request carries a timeout or a caller cancel signal. The eslint-disable-next-line @typescript-eslint/no-unused-vars comment next to it was silencing the linter that had caught this.
  2. Inverted branch. console.debug('AbortSignal.timeout is not defined...') sits in the else of if (options.signal), inside if (AbortSignal.timeout). So it prints exactly when AbortSignal.timeout is defined and the caller passed no signal, which is the normal case for every SDK call on Node 17+. On a server that ships JSON logs this is one unparseable plain-text line per Looker request.

Changes

  • Assign the outer signaller instead of shadowing it, so the timeout (and any composed caller signal) reaches the request.
  • Move the "not defined" debug message to the branch where AbortSignal.timeout really is missing.
  • In that fallback branch, still pass a caller-supplied signal through rather than dropping it.
  • Add baseTransport.spec.ts covering: default timeout attached, timeout aborts, caller signal composed with timeout, and the no-AbortSignal.timeout fallback (message logged, caller signal honored).

Relationship to #1582

#1582 by @p3drosola fixes the same two bugs and has been mergeable since May 2025, but it is blocked on the CLA check and has no tests. This PR supersedes it with a signed CLA and regression coverage; credit for the diagnosis goes to that PR. Happy to close this one if #1582 can move forward instead.

Behavior note for reviewers

Because the signal was previously dropped, merging this means the documented 120 s default timeout (defaultTimeout in transport.ts) starts applying for real. That is the intended behavior per the existing code and docs, but it is a change consumers will observe on long-running calls.

Developer Checklist

  • Ensure the tests and linter pass
  • Appropriate docs were updated (if necessary) — no doc changes needed

…"not defined" message

`BaseTransport.initRequest` shadowed its own `signaller` variable, so the
`AbortSignal` it built never reached the request: no timeout and no caller
cancel signal ever applied. The "AbortSignal.timeout is not defined" debug
message also sat in the wrong branch and printed on every request where
`AbortSignal.timeout` *was* defined and no caller signal was passed, which is
the normal case on Node 17+.

- assign the outer `signaller` instead of redeclaring it
- move the "not defined" message to the branch where it is true
- in that fallback, still pass a caller-supplied signal through
- add baseTransport.spec.ts covering both paths

Supersedes looker-open-source#1582 (same fix, blocked on CLA, no tests).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant