santifer/career-ops · error · Error

larajobs: URL must use HTTPS

Error message

larajobs: URL must use HTTPS: ${url}

What it means

assertLarajobsUrl enforces HTTPS: a successfully parsed URL whose protocol is not 'https:' is rejected with this error. This keeps job-feed traffic off plaintext transports and prevents accidental downgrade to http.

Solutions

  1. Change the scheme to https:// in the URL or config entry.
  2. Grep the config for 'http://' and correct each occurrence.
  3. Verify with new URL(u).protocol === 'https:' before invoking the provider.
  4. If the endpoint lacks HTTPS support, remove the entry — the validator intentionally cannot be bypassed.

Example fix

// before
assertLarajobsUrl('http://larajobs.com/api/jobs');
// after
assertLarajobsUrl('https://larajobs.com/api/jobs');
Defensive patterns

Strategy: validation

Validate before calling

function isHttpsUrl(u) { try { return new URL(u).protocol === 'https:'; } catch { return false; } }
if (!isHttpsUrl(url)) throw new Error(`larajobs endpoint must be https: ${url}`);

Type guard

function isHttpsUrlString(v) { if (typeof v !== 'string') return false; try { return new URL(v).protocol === 'https:'; } catch { return false; } }

Try / catch

try {
  provider.fetch(entry, ctx);
} catch (e) {
  if (e.message.startsWith('larajobs: URL must use HTTPS')) {
    console.warn(`Upgrading to https: ${e.message}`);
    return provider.fetch({ ...entry, url: entry.url.replace(/^http:/, 'https:') }, ctx);
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing any http:// (or other non-https scheme) larajobs URL to assertLarajobsUrl or the provider's fetch path, e.g. 'http://larajobs.com/api/jobs'.

Common situations: Legacy config entries using http://, a user editing portals.yml by hand and dropping the 's', or an internal mirror URL written with http.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at providers/larajobs.mjs:27

//
// Each <item> carries the standard RSS fields plus a `job:` namespace with
// `<job:company>` and `<job:location>`, so company and location come straight
// from the feed (no title-splitting heuristics needed).
//
// Wire in via a `job_boards:` entry with `provider: larajobs`.

const FEED_URL = 'https://larajobs.com/feed';
const TRUSTED_HOST = 'larajobs.com';

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

// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.
function toEpochMs(value) {
  if (!value) return undefined;
  const parsed = Date.parse(value);
  return Number.isNaN(parsed) ? undefined : parsed;
}

function fallbackCompany(entry) {
  return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'LaraJobs';
}

/** @type {Provider} */

View on GitHub (pinned to aac998c7ed)