If Flaggish is down

Flag checks never throw. If the API can’t be reached, your app keeps answering from the last flags it had, then your defaults.

The short version

  • Checks never throw or reject. Network failures, timeouts, a missing or wrong client key and bad responses all turn into an answer.
  • A server that has already loaded your flags keeps using them.
  • A check waits at most 2 seconds for the API, and only when its cache needs refreshing.
  • Your app keeps running. Only dashboard changes stop arriving until Flaggish is back.

Where the answer comes from

Each check uses the first of these that has an answer:

  1. The config. The fresh one, or if a refresh failed, the last one the SDK fetched successfully.
  2. The fallback you pass to the check: getFlag(key, ctx, fallback) or isEnabled(key, ctx, fallback).
  3. Your defaults: the defaults option.
  4. false.

useFlag(key, fallback) in React checks your defaults before its fallback, so set your values in defaults if you use both.

App.tsx
<FlaggishProvider defaults={{ 'new-checkout': false, 'maintenance-banner': true }}>

Pick defaults that are safe: usually the old behaviour, so a new feature stays off if Flaggish can’t be reached.

Timeouts and retries

SettingDefaultWhat happens
Request timeout2 secondsA config request that takes longer is abandoned, and the check uses the fallbacks above.
Cache30 secondsFlags are reused for 30 seconds. A failed fetch also waits 30 seconds before the next try, so an outage isn’t hammered.

During an outage, one check every 30 seconds waits for the timeout; the checks in between answer straight away from memory. Checks that arrive while a fetch is in flight share it, so they don’t each wait separately. Change both with timeoutMs and cacheTtlMs.

The SDK logs one console warning when fetches start failing, not one per check:

Console
[flaggish] Could not fetch flag config, using fallbacks: …

What your users see

SituationUsers get
A server that loaded flags before the outageThe same answers as before, including rollouts. They don’t notice.
A server that starts during the outageYour fallbacks and defaults until Flaggish is back
A browser page loaded during the outage, with FlaggishServerProviderWhatever the server had, passed down on first render
A browser page loaded during the outage, with FlaggishProvider aloneYour defaults, after the request times out
Pages already openThe answers they loaded. They don’t change.

When Flaggish comes back, the next refresh picks up your current flags, within about 30 seconds.

Reach during an outage

Reach is best effort. If it can’t be sent, it’s dropped: it never throws, never logs, and never changes or delays a flag result.

Next.js render signals

The one thing the server helpers let through is Next.js’s own render-control signal, for example the one cookies() raises when a cacheComponents prerender ends. Next.js expects it, and uses it to render the component per request. It’s not an error. See Suspense and cacheComponents.

Was this page helpful?

Request early access

Become a beta user, or stay up to date with the project.