gethomepage/homepage · error · Error

Authorization failure getting data from glances API. Data: $

Error message

Authorization failure getting data from glances API. Data: ${data.toString()}

What it means

Thrown when the upstream Glances instance responds HTTP 401 to Homepage's proxied GET. Homepage treats 401 distinctly from other non-200 statuses because it usually means the configured username/password is wrong or missing for a protected Glances API.

Source

Thrown at src/pages/api/widgets/glances.js:33

  }

  const apiUrl = `${url}/api/${privateWidgetOptions.version}/${endpoint}`;
  const headers = {
    "Accept-Encoding": "application/json",
  };
  if (privateWidgetOptions.username && privateWidgetOptions.password) {
    headers.Authorization = `Basic ${Buffer.from(
      `${privateWidgetOptions.username}:${privateWidgetOptions.password}`,
    ).toString("base64")}`;
  }
  const params = { method: "GET", headers };

  const [status, , data] = await httpProxy(apiUrl, params);

  if (status === 401) {
    errorMessage = `Authorization failure getting data from glances API. Data: ${data.toString()}`;
    logger.error(errorMessage);
    throw new Error(errorMessage);
  }

  if (status !== 200) {
    errorMessage = `HTTP ${status} getting data from glances API. Data: ${data.toString()}`;
    logger.error(errorMessage);
    throw new Error(errorMessage);
  }

  return JSON.parse(Buffer.from(data).toString());
}

export default async function handler(req, res) {
  const { index, cputemp: includeCpuTemp, uptime: includeUptime, disk: includeDisks, version } = req.query;

  const privateWidgetOptions = await getPrivateWidgetOptions("glances", index);
  privateWidgetOptions.version = parseVersionForUrl(version, 3);

  try {

View on GitHub (pinned to b6dca1ae03)

Solutions

  1. In the Glances widget config, set both username and password to match Glances' configured auth.
  2. Confirm Glances actually requires auth — if not, remove the credentials so no Authorization header is sent.
  3. Check that any reverse proxy in front of Glances forwards the Authorization header.
  4. Test the credentials directly: `curl -u user:pass http://glances:61108/api/3/cpu`.

Example fix

// before
widget:
  type: glances
  url: http://glances:61108
  username: admin
  password: wrongpass

// after
widget:
  type: glances
  url: http://glances:61108
  username: admin
  password: correctpass
Defensive patterns

Strategy: try-catch

Validate before calling

async function canReachGlances(url, creds) {
  const headers = {};
  if (creds?.username && creds?.password) {
    headers.Authorization = 'Basic ' + Buffer.from(`${creds.username}:${creds.password}`).toString('base64');
  }
  const res = await fetch(`${url}/api/3/version`, { headers });
  return res.status !== 401;
}

Try / catch

try {
  await retrieveFromGlancesAPI(options, endpoint);
} catch (err) {
  if (/Authorization failure/.test(err.message)) {
    // surface a user-friendly 'wrong Glances credentials' message
  }
  throw err;
}

Prevention

When it happens

Trigger: retrieveFromGlancesAPI() builds the request, calls httpProxy(apiUrl, params), and `status === 401`. Occurs when Glances has auth enabled and the widget either sent no credentials or sent wrong ones (Basic auth built from username/password).

Common situations: Glances was recently secured with a username/password but the Homepage widget config wasn't updated; password rotated on the Glances side; username has a typo; credentials worked over HTTP but the Glances reverse proxy now strips the Authorization header.

Related errors


AI-assisted analysis of gethomepage/homepage@b6dca1ae03 (2026-08-13). Data as JSON: /api/errors/2e218ebcb81637ca. Report an issue: GitHub.