authelia/authelia · critical · Error
No ${variableName} embedded variable detected
Error message
No ${variableName} embedded variable detected What it means
getEmbeddedVariable reads data-{name} attributes that Authelia's backend injects into the <body> tag of the templated index.html (e.g. data-duoselfenrollment, data-logooverride, data-theme, data-rememberme, data-resetpassword). The throw means the attribute is absent, i.e. the HTML was not rendered by Authelia's server-side template. This usually breaks the portal at bootstrap, since these flags drive first-factor options and theming.
Source
Thrown at web/src/utils/Configuration.ts:4
export function getEmbeddedVariable(variableName: string) {
const value = document.body.getAttribute(`data-${variableName}`);
if (value === null) {
throw new Error(`No ${variableName} embedded variable detected`);
}
return value;
}
export function getDuoSelfEnrollment() {
return getEmbeddedVariable("duoselfenrollment") === "true";
}
export function getLogoOverride() {
return getEmbeddedVariable("logooverride") === "true";
}
export function getRememberMe() {
return getEmbeddedVariable("rememberme") === "true";
}
export function getResetPassword() {View on GitHub (pinned to c883b8d3d8)
Solutions
- Serve the SPA through the Authelia backend so index.html is templated with the data-* attributes
- If serving statically (dev), add the attributes manually to web/index.html's body tag
- View page source and confirm <body> carries data-duoselfenrollment etc.; purge CDN/service-worker caches if not
- Check the attribute name matches exactly: the lookup is `data-${variableName}` verbatim, all lowercase
- After upgrades, hard-refresh or bust the index.html cache
Example fix
<!-- before --> <body> <!-- after (dev/static hosting; Authelia injects these server-side in production) --> <body data-duoselfenrollment="false" data-logooverride="false" data-theme="auto" data-rememberme="true" data-resetpassword="true">
Defensive patterns
Strategy: validation
Validate before calling
const name = 'duoselfenrollment';
if (!document.body.hasAttribute(`data-${name}`)) {
// HTML not templated by Authelia: fall back to defaults or block boot with a clear message
return fallbackDefaults[name];
}
return getEmbeddedVariable(name); Type guard
function hasEmbeddedVariable(name: string): boolean {
return document.body.getAttribute(`data-${name}`) !== null;
} Try / catch
try {
return getEmbeddedVariable('duoselfenrollment') === 'true';
} catch (err) {
if (err instanceof Error && err.message.includes('embedded variable')) {
return false; // safe default; log loudly because the deployment is misconfigured
}
throw err;
} Prevention
- Always serve the portal through Authelia so index.html is templated
- Smoke-test deployments with view-source: <body> must show the data-* attributes
- Bust CDN/service-worker caches for index.html after upgrades
When it happens
Trigger: Loading the SPA from a source that does not template index.html: the vite dev server or a static file server hosting web/ directly; a deployment that strips body attributes; a stale cached index.html from a CDN or service worker after an upgrade.
Common situations: Running the frontend standalone in development; nginx serving the built assets instead of proxying to Authelia; an over-aggressive HTML minifier or CDN rewriting the body tag; accessing the portal through a cache holding a pre-render artifact.
Related errors
AI-assisted analysis of authelia/authelia@c883b8d3d8 (2026-08-15).
Data as JSON: /api/errors/77ae67f02d613bf2.
Report an issue: GitHub.