Skip to content

fix: Accept eventsUri option in Fastly SDK init()#1791

Merged
keelerm84 merged 2 commits into
mainfrom
mk/sdk-2644/fix-eventsuri-init
Jul 7, 2026
Merged

fix: Accept eventsUri option in Fastly SDK init()#1791
keelerm84 merged 2 commits into
mainfrom
mk/sdk-2644/fix-eventsuri-init

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

validateOptions in the Fastly Compute SDK omitted eventsUri from its destructure, so a supported, documented option fell through to the unsupported-keys guard and made init() throw Invalid configuration: eventsUri not supported. Any customer routing events through a proxy or custom host via init(clientSideId, kvStore, { eventsUri }) could not construct a client at all.

  • Add eventsUri to the validateOptions destructure so it is no longer treated as an unsupported key.
  • Replace the JSON.stringify(rest) !== '{}' guard with an Object.keys(rest).length check. This also fixes two latent bugs in the same guard: unsupported keys with an undefined value were silently accepted (JSON.stringify drops them), and non-serializable values (BigInt, circular refs) threw an opaque TypeError instead of the intended configuration error.
  • Add regression tests. The existing eventsUri success test constructed LDClient directly and bypassed validateOptions; the new tests drive eventsUri through init() and through validateOptions directly.

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 documented eventsUri option by including eventsUri in the validateOptions destructure so it no longer lands in the unsupported-keys check and triggers Invalid configuration: eventsUri not supported.

Hardens unsupported-option detection by replacing JSON.stringify(rest) !== '{}' with Object.keys(rest).length, so keys with undefined values are still rejected and non-serializable values no longer surface as opaque TypeErrors.

Adds regression coverage for eventsUri / eventsBackendName via validateOptions and via init() (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.

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.
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26365 bytes
Compressed size limit: 29000
Uncompressed size: 129044 bytes

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179504 bytes
Compressed size limit: 200000
Uncompressed size: 831427 bytes

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32027 bytes
Compressed size limit: 34000
Uncompressed size: 114248 bytes

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38747 bytes
Compressed size limit: 39000
Uncompressed size: 212249 bytes

@keelerm84 keelerm84 marked this pull request as ready for review July 7, 2026 17:45
@keelerm84 keelerm84 requested a review from a team as a code owner July 7, 2026 17:45
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.
@keelerm84 keelerm84 merged commit 18deecd into main Jul 7, 2026
53 checks passed
@keelerm84 keelerm84 deleted the mk/sdk-2644/fix-eventsuri-init branch July 7, 2026 19:39
@github-actions github-actions Bot mentioned this pull request Jul 7, 2026
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.

2 participants