santifer/career-ops · error · Error

jobspresso: invalid URL

Error message

jobspresso: invalid URL: ${url}

What it means

assertJobspressoUrl validates URLs used by the Jobspresso provider (jobspresso.co WordPress job feed). It throws 'invalid URL' when new URL(url) throws — i.e. the string is not a parseable absolute URL. This is the first validation gate (before HTTPS and hostname checks) in the provider's SSRF protections.

Solutions

  1. Fix the configured URL to a full absolute https:// URL, e.g. https://jobspresso.co/?feed=job_feed
  2. Echo the raw config value (including hidden whitespace) and clean it
  3. Test with new URL(value) in a Node REPL until it parses
  4. Build URLs from the provider's FEED_URL constant instead of hand-typing

Example fix

// before
url: jobspresso.co/?feed=job_feed
// after
url: https://jobspresso.co/?feed=job_feed
Defensive patterns

Strategy: validation

Validate before calling

function isValidJobspressoUrl(url) {
  try {
    const p = new URL(url);
    return p.protocol === 'https:' && p.hostname === 'jobspresso.co';
  } catch { return false; }
}

Type guard

function isParseableUrl(v) {
  return typeof v === 'string' && URL.canParse(v);
}

Try / catch

try {
  assertJobspressoUrl(cfg.url);
} catch (e) {
  if (/invalid URL/.test(e.message)) {
    console.error(`jobspresso entry has a malformed URL: ${JSON.stringify(cfg.url)}`);
    return [];
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling assertJobspressoUrl with '', 'jobspresso.co/?feed=job_feed' (no scheme), 'https://', or any string the URL constructor rejects.

Common situations: Config entry in portals.yml missing the https:// scheme; an env placeholder left unsubstituted; whitespace or invisible characters contaminating the config value; a relative URL passed where an absolute one is required.

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/98a29dd0ed3893ea. Report an issue: GitHub.

Appendix: source

Thrown at providers/jobspresso.mjs:21

/** @typedef {import('./_types.js').Provider} Provider */

// Jobspresso provider - public WordPress jobs feed
// (https://jobspresso.co/?feed=job_feed). The feed is public, no-auth,
// and XML, so it is parsed in-process with the same tiny tag extractor
// approach as providers/personio.mjs rather than adding an XML dependency.
//
// Wire in via a `job_boards:` entry with `provider: jobspresso`.

const FEED_URL = 'https://jobspresso.co/?feed=job_feed';
const TRUSTED_HOST = 'jobspresso.co';

/** @param {string} url */
function assertJobspressoUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`jobspresso: invalid URL: ${url}`);
  }
  if (parsed.protocol !== "https:")
    throw new Error(`jobspresso: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_HOST) {
    throw new Error(
      `jobspresso: 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;
}

View on GitHub (pinned to aac998c7ed)