Skip to content
FlagPilot
Menu

Node SDK

waitForInitialization

Wait until the first snapshot is loaded, or fail after a timeout or a rejected key.

Resolves as soon as the client holds a snapshot, from delivery or from the cache file. Rejects after the timeout, when delivery rejects the key, or when the client is closed first.

You do not have to wait: before the first snapshot every evaluation returns your default with reason ERROR / NOT_INITIALIZED.

Signature
waitForInitialization(opts?: { timeoutMs?: number }): Promise<void>
Example
await flags.waitForInitialization({ timeoutMs: 5_000 });

The SDK is @rollkit/sdk in the repository (packages/sdk). It is for server-side Node; browsers use a client key with the delivery API.