santifer/career-ops · error · Error

torre: URL must use HTTPS

Error message

torre: URL must use HTTPS: ${url}

What it means

The torre provider validates every URL it is handed through assertTorreUrl before making a request. After parsing succeeds, it requires the protocol to be exactly https:. Any http:, ftp:, or other scheme is rejected with this error, since the provider only ever talks to the TLS-only Torre search API and will not downgrade a URL that was misconfigured to plain HTTP.

Solutions

  1. Change the URL in the portal entry to use https:// instead of http://
  2. If the URL is built programmatically, hardcode the https: scheme rather than deriving it from user input
  3. Verify the final URL with new URL(url).protocol === 'https:' before passing it to the provider

Example fix

// before
careers_url: http://search.torre.co/opportunities/_search
// after
careers_url: https://search.torre.co/opportunities/_search
Defensive patterns

Strategy: validation

Validate before calling

function assertHttpsUrl(url) {
  const parsed = new URL(url); // throws if unparseable
  if (parsed.protocol !== 'https:') {
    throw new Error(`URL must use HTTPS: ${url}`);
  }
  return url;
}
// call before invoking the provider: assertHttpsUrl(entry.careers_url)

Type guard

const isHttpsUrl = (u) => { try { return new URL(u).protocol === 'https:'; } catch { return false; } };

Try / catch

try {
  await provider.fetch(entry);
} catch (err) {
  if (err.message.startsWith('torre:') && err.message.includes('must use HTTPS')) {
    console.error(`Config error: fix ${entry.name} careers_url to https:// — ${err.message}`);
    return; // skip entry, do not retry
  }
  throw err;
}

Prevention

When it happens

Trigger: A portals.yml job_boards entry (or any caller passing a URL into the torre provider) specifies a careers_url or endpoint starting with http:// instead of https://, e.g. 'http://search.torre.co/opportunities/_search'. The URL parses fine as a URL, so the invalid-URL branch is not hit; only the scheme check fires.

Common situations: Hand-editing portals.yml and forgetting the trailing 's', copying a URL from an insecure redirect or old documentation, template placeholders that concatenate 'http://' as a default prefix, or a stored config value that was normalized to http somewhere upstream.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/65904d93d3f1a9eb. Report an issue: GitHub.

Appendix: source

Thrown at providers/torre.mjs:92

// same result set, so the default is arbitrary among them.
const EXPERIENCE_LEVELS = new Set([
  'potential-to-develop',
  '1-plus-year',
  '2-plus-years',
  '3-plus-years',
  '5-plus-years',
]);
const DEFAULT_EXPERIENCE = '1-plus-year';

/** @param {string} url */
function assertTorreUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`torre: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`torre: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_API_HOST) {
    throw new Error(`torre: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_API_HOST}`);
  }
  return url;
}

/**
 * Build the search body from the portal entry. Only filters proven to affect
 * `total` are emitted — see the header note. Exported for tests.
 *
 * @param {any} entry
 * @returns {object}
 */
export function buildTorreQuery(entry) {
  /** @type {Record<string, unknown>} */
  const body = {};

  const search = typeof entry?.search === 'string' ? entry.search.trim() : '';

View on GitHub (pinned to aac998c7ed)