santifer/career-ops · error · Error

glints: invalid URL: ${url}

Error message

glints: invalid URL: ${url}

What it means

glints.mjs throws this inside assertGlintsUrl() when `new URL(url)` raises — the string is not an absolute, parseable URL. Unlike the constant-pinned providers, Glints validates entry.api (the operator-overridable GraphQL endpoint) falling back to DEFAULT_API, so a live throw most often comes from a malformed api: value in portals.yml.

Source

Thrown at providers/glints.mjs:75

        salaryMode
        maxAmount
        minAmount
        CurrencyCode
      }
      createdAt
    }
    expInfo
    hasMore
  }
}`;

/** @param {string} url */
function assertGlintsUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`glints: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`glints: URL must use HTTPS: ${url}`);
  if (!ALLOWED_GLINTS_HOSTS.has(parsed.hostname))
    throw new Error(`glints: untrusted hostname "${parsed.hostname}" — must be one of: ${[...ALLOWED_GLINTS_HOSTS].join(', ')}`);
  return url;
}

// NaN-safe Date.parse
function toEpochMs(value) {
  if (!value) return undefined;
  const parsed = Date.parse(value);
  return Number.isNaN(parsed) ? undefined : parsed;
}

/**
 * Derive the job detail base URL from the API hostname.
 * @param {string} apiUrl
 * @returns {string}

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Set api to a full absolute URL (e.g. https://glints.com/api/v2-alc/graphql) or remove the api field to use the default.
  2. Check the YAML around the api: line for stray quotes, spaces, or an unclosed string.
  3. If the value comes from an env var, confirm it resolves to a real URL in the target environment.

Example fix

# before
- name: Glints (ID)
  provider: glints
  api: /api/v2-alc/graphql   # relative -> throws

# after
- name: Glints (ID)
  provider: glints
  api: https://glints.com/api/v2-alc/graphql
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: validate a Glints entry.api (or the default) before fetching.
function glintsApiIsValid(entry) {
  const api = entry.api || 'https://glints.com/api/v2-alc/graphql';
  let u;
  try { u = new URL(api); } catch { return false; }
  return u.protocol === 'https:';
}

Prevention

When it happens

Trigger: A portals.yml entry sets api to a relative path, a string with spaces/quotes, an empty string, or undefined; api was built from an env var that resolved to a non-URL; a test calls assertGlintsUrl('/api/v2-alc/graphql').

Common situations: Operator points Glints at a custom endpoint but types a path-only value; a templated/CI-generated portals.yml left api blank or malformed; an env override injected a bad value.

Related errors


AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13). Data as JSON: /api/errors/00f65e302501e9ed. Report an issue: GitHub.