fix: Accept eventsUri option in Fastly SDK init()#1791
Merged
Conversation
validateOptions omitted eventsUri from its destructure, so a supported, documented option fell into the unsupported-keys check and made init() throw "Invalid configuration: eventsUri not supported". Add eventsUri to the destructure and replace the JSON.stringify guard with an Object.keys length check (which also fixes false negatives on undefined-valued keys and opaque TypeErrors on non-serializable values). Add regression tests that drive eventsUri through init(); the existing success test bypassed validateOptions by constructing LDClient directly.
Contributor
|
@launchdarkly/js-sdk-common size report |
Contributor
|
@launchdarkly/browser size report |
Contributor
|
@launchdarkly/js-client-sdk size report |
Contributor
|
@launchdarkly/js-client-sdk-common size report |
joker23
approved these changes
Jul 7, 2026
The new init() eventsUri test created a client whose event processor flush timer was never cleared, leaving an open handle that kept jest from exiting (CI runs jest without --forceExit and timed out). Close the client at the end of the test.
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.
Summary
validateOptionsin the Fastly Compute SDK omittedeventsUrifrom its destructure, so a supported, documented option fell through to the unsupported-keys guard and madeinit()throwInvalid configuration: eventsUri not supported. Any customer routing events through a proxy or custom host viainit(clientSideId, kvStore, { eventsUri })could not construct a client at all.eventsUrito thevalidateOptionsdestructure so it is no longer treated as an unsupported key.JSON.stringify(rest) !== '{}'guard with anObject.keys(rest).lengthcheck. This also fixes two latent bugs in the same guard: unsupported keys with anundefinedvalue were silently accepted (JSON.stringifydrops them), and non-serializable values (BigInt, circular refs) threw an opaqueTypeErrorinstead of the intended configuration error.eventsUrisuccess test constructedLDClientdirectly and bypassedvalidateOptions; the new tests driveeventsUrithroughinit()and throughvalidateOptionsdirectly.Part of the Fastly refresh epic (SDK-2643). Fixes SDK-2644.
Note
Low Risk
Narrow validation and test changes in the Fastly SDK; no auth, data, or runtime behavior changes beyond accepting a previously documented option.
Overview
Fixes
init()rejecting the documentedeventsUrioption by includingeventsUriin thevalidateOptionsdestructure so it no longer lands in the unsupported-keys check and triggersInvalid configuration: eventsUri not supported.Hardens unsupported-option detection by replacing
JSON.stringify(rest) !== '{}'withObject.keys(rest).length, so keys withundefinedvalues are still rejected and non-serializable values no longer surface as opaqueTypeErrors.Adds regression coverage for
eventsUri/eventsBackendNameviavalidateOptionsand viainit()(with client teardown to avoid Jest hanging on the event flush timer).Reviewed by Cursor Bugbot for commit d557fcf. Bugbot is set up for automated code reviews on this repo. Configure here.