santifer/career-ops · error · Error

rippling: invalid URL: ${url}

Error message

rippling: invalid URL: ${url}

What it means

assertRipplingApiUrl throws this when new URL(url) raises — the string is not a parseable absolute URL. rippling builds its API URL from constants (API_BASE + slug), so this guard would only fire if the slug interpolation corrupted the URL (e.g. injecting illegal characters that escaped encodeURIComponent) or if the constant itself was malformed.

Source

Thrown at providers/rippling.mjs:54

  if (parsed.protocol !== 'https:') return null;
  if (parsed.hostname !== CAREERS_HOST) return null;
  const segment = parsed.pathname.split('/').filter(Boolean)[0] || '';
  if (!SLUG_RE.test(segment)) return null;
  return segment;
}

/** Build the board API URL for a validated slug. */
function apiUrlForSlug(slug) {
  return `${API_BASE}/${encodeURIComponent(slug)}/jobs`;
}

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

/** @type {Provider} */
export default {
  id: 'rippling',

  detect(entry) {
    const slug = resolveSlug(entry);
    return slug ? { url: apiUrlForSlug(slug) } : null;
  },

  async fetch(entry, ctx) {

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Log the exact URL string passed into the guard to see what is malformed.
  2. Verify API_BASE is 'https://api.rippling.com/platform/api/ats/v1/board'.
  3. Confirm the slug was passed through encodeURIComponent and contains no raw slashes or spaces.
  4. Revert changes to the URL-building helpers (apiUrlForSlug / API_BASE).

Example fix

// before — slug injected raw, breaking the URL
const apiUrl = `${API_BASE}/${slug}/jobs`;
// after — slug encoded
const apiUrl = `${API_BASE}/${encodeURIComponent(slug)}/jobs`;
Defensive patterns

Strategy: validation

Validate before calling

function isParseableUrl(s) {
  try { new URL(s); return true; } catch { return false; }
}
// rippling builds URLs via apiUrlForSlug — unit-test the builder
const apiUrl = apiUrlForSlug('test-slug');
if (!isParseableUrl(apiUrl)) throw new Error('rippling: apiUrlForSlug produces an invalid URL');

Type guard

null

Try / catch

try {
  await provider.fetch(entry, ctx);
} catch (e) {
  if (/rippling: invalid URL/.test(e.message)) {
    console.error('[bug] rippling URL construction broken — check apiUrlForSlug/API_BASE');
  } else throw e;
}

Prevention

When it happens

Trigger: The URL passed to assertRipplingApiUrl lacks a scheme, contains characters the URL constructor rejects, or the API_BASE constant was broken. Because encodeURIComponent sanitizes the slug, a raw throw here points at the constant or at a non-standard call path.

Common situations: API_BASE constant was edited to drop the https:// scheme; someone called assertRipplingApiUrl with a hand-built URL string that is malformed; a code refactor broke the URL assembly.

Related errors


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