fix: enforce configured request timeout - #15
Merged
Conversation
timeoutMs was resolved and stored (default 30s) but never applied — the GraphQLClient was constructed without any signal, so requests could hang indefinitely. Wrap the configured fetch so every request carries an AbortSignal.timeout(timeoutMs), honoring a caller-supplied signal when present. Covers both gqlRequest and the resource SDK path, since both share the client's fetch.
Merged
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.
Problem
ClientConfig.timeoutMsis accepted, documented (default 30s), and resolved intoResolvedClientConfig— but never used. TheGraphQLClientwas constructed with onlyfetchandheaders, no signal:So a hung or slow server would block a request indefinitely, and the
timeoutMsoption (and its default) silently did nothing.Fix
Wrap the configured
fetchso every request carriesAbortSignal.timeout(timeoutMs), while honoring a caller-suppliedsignalif one is passed:This applies to both the
gqlRequestpath and the resource SDK path (getSdk(graphqlClient)), since both share the client'sfetch.Tests
Two added to
client.test.ts:AbortSignalderived fromtimeoutMstimeoutMsrejectsAbortSignal.timeoutrequires Node ≥17.3 — well within the SDK's Node ≥18.18 floor.Note
This is a genuine
fix:(touchespackages/core), so it will trigger a release-please PR for@ambosstech/core.