Skip to content

The no-consent-banner startup warning (and its false positive)

One advisory line on the first request reports that nothing places the consent module; it scans stored layouts only, so a banner in app chrome trips it.

One line, once per process, on the first request that reaches the API:

text
[kywi] Cookie consent is required (theme.personalization.requireConsent) but no page or layout places the `cookieConsent` module, so no visitor can ever grant it. Every personalization cookie stays suppressed: audiences, A/B bucketing and UTM attribution will resolve to default content for everyone. Place the module, or set personalization: { requireConsent: false } if consent is collected by external tooling, or set personalization.consentBanner: 'host' if the banner is mounted in app chrome.

It is advisory and nothing else: never awaited, so the request that triggers it does not wait for the query, and every error it could raise is swallowed. It cannot fail a boot, slow a page, or change what a visitor sees. What it can do is be wrong.

What it actually looks at

sql
SELECT 1 AS found
FROM kywi_content
WHERE layout IS NOT NULL
  AND layout::text LIKE '%"cookieConsent"%'
UNION ALL
SELECT 1 AS found
FROM kywi_section_templates
WHERE definition IS NOT NULL
  AND definition::text LIKE '%"cookieConsent"%'
LIMIT 1

Two places a module can be placed — a page's stored layout, and a section template a page composes from — matched as raw text. Nothing else is consulted, and no row is opened to check that the match is a real placement.

The false positive: a banner in app chrome

There is a third placement the query cannot see. A banner rendered by the host application itself — mounted in the shell so it covers every page, rather than dropped into one page's layout — never appears in a layout document, so the scan finds nothing and warns while the banner is on screen. This site is built that way and logged the warning on every boot until the flag below existed.

kywi.config.tsts
personalization: {
  // The banner is mounted in the app shell, not placed as a layout module.
  consentBanner: 'host',
}

That is the whole fix, and it is a config change rather than a code one. The check returns before issuing any query at all: the host has declared it handles this itself, so there is nothing in the database to look for. It also stays quiet when the gate is off entirely — the same guard covers both. Where the flag sits in the theme is Wiring personalization and consent.

What it is not

It is not a startup failure, and it is not the consent gate. The two checks that do stop a deploy — sites disagreeing with each other, and the config disagreeing with KYWI_REQUIRE_CONSENT — are Consent policy: the startup-throw and the env mirror. This one only decides whether to print a line. When the warning is genuine, though, its subject is real: with consent required and no way to grant it, audiences, A/B bucketing and UTM attribution resolve to default content for every visitor, which reads as a broken personalization setup rather than a gated one (What consent does to your targeting).