Consent policy: the startup-throw and the env mirror
Edge middleware cannot read the config, so requireConsent is mirrored as an env var, and the API handler throws at startup when the two disagree.
Consent is one setting held in two places. Next.js edge middleware runs before any of your code and cannot read kywi.config.ts, so theme.personalization.requireConsent is mirrored to the edge as the environment variable KYWI_REQUIRE_CONSENT. The mirror is read by exactly one rule — anything but the literal string false is true — so unset is true, 0 is true, an empty value is true, and FALSE is true. There is no third state for "not configured".
The API handler refuses to start while the two disagree. This is a throw and not a warning on purpose: the halves of one setting pointing opposite ways is never intentional, and the result — the edge writing a visitor cookie the API then declines to read, or the reverse — is invisible at runtime and survives to production because nothing looks broken.
Cookie-consent misconfiguration: theme.personalization.requireConsent is false but KYWI_REQUIRE_CONSENT is unset (which means true).
Next.js edge middleware cannot read kywi.config.ts, so it mirrors that flag through KYWI_REQUIRE_CONSENT. While they disagree, the middleware and the API disagree about whether a visitor may be tracked.
Set both, or neither: KYWI_REQUIRE_CONSENT=false alongside personalization: { requireConsent: false }, or remove both.The variable's raw value is printed quoted, so KYWI_REQUIRE_CONSENT is "0" or "true" in that first line is telling you the value is not the one string that would have turned the gate off.
The setting that survives a deploy
Consent required, both halves left alone: requireConsent unset in the theme, and KYWI_REQUIRE_CONSENT deliberately not set on the service. Both default to true, so they agree, and there is no variable for someone to change by accident later. That is how this project's own production deployment is configured.
Turning the gate off is a two-file change that has to land in one deploy — redeploying the config without the variable, or setting the variable without the config, is the failure above:
# on the service
KYWI_REQUIRE_CONSENT=false// in the theme, kywi.config.ts
personalization: { requireConsent: false }Every site in one deployment shares one policy
requireConsent is a theme flag, so a multi-site config can express one policy per site — but the mirror is a single process-wide variable, and one variable cannot carry two answers. So the sites are checked against each other first, and the agreed answer is what gets compared with the environment. On a multi-site deployment this is the message you see first:
Cookie-consent misconfiguration: configured sites disagree about theme.personalization.requireConsent.
marketing (requireConsent: true)
docs (requireConsent: false)
Edge middleware mirrors this flag through the single KYWI_REQUIRE_CONSENT env var, which cannot carry one value per site. Until a per-host mirror exists, every site in one deployment must share one consent policy.
Set the same personalization.requireConsent on every site's theme.Before 0.17.0 the policy was resolved from the first configured site, which meant a second site silently inherited site one's privacy default — a privacy decision taken by accident. Failing the deploy replaced that. A config with no sites at all throws its own line: [kywi] Consent policy check: at least one site must be configured.
Neither check says anything about whether visitors are actually granting consent. A deployment that boots cleanly with the gate on and no way to grant it suppresses every personalization cookie — that is the no-consent-banner warning, an advisory line rather than a throw. What the gate costs a personalized page is What consent does to your targeting; the theme block itself is Wiring personalization and consent.