santifer/career-ops · error · Error
4dayweek: URL must use HTTPS
Error message
4dayweek: URL must use HTTPS: ${url} What it means
After successfully parsing, assertFourDayUrl() enforces that the URL uses HTTPS (parsed.protocol === 'https:'). Any http:// (or other scheme like ftp:) URL passed to the 4dayweek provider throws this error. The library refuses plaintext HTTP to avoid insecure fetches and to guarantee requests only go to the expected origin.
Solutions
- Change the URL scheme to https:// (e.g. https://4dayweek.io/jobs)
- Search your config (portals.yml and any custom provider config) for 'http://4dayweek' and fix all occurrences
- If a source system only serves http, locate the canonical HTTPS URL of the same resource — the provider will not accept the insecure one
- Validate before calling: assert new URL(url).protocol === 'https:' in your own config loader to fail fast at startup
Example fix
// before const url = 'http://4dayweek.io/jobs'; // after const url = 'https://4dayweek.io/jobs';
Defensive patterns
Strategy: validation
Validate before calling
// Enforce HTTPS in your config loader before the provider sees the value
const u = new URL(cfg.url);
if (u.protocol !== 'https:') throw new Error(`4dayweek URL must be https:// (got ${u.protocol}) in ${configKey}`); Type guard
function isHttpsUrl(v) {
try { return new URL(v).protocol === 'https:'; } catch { return false; }
} Try / catch
try {
await fetchFourDayWeek(url);
} catch (e) {
if (String(e.message).startsWith('4dayweek: URL must use HTTPS')) {
console.error(`Fix config: '${url}' must start with https://.`);
} else throw e;
} Prevention
- Standardize on https:// in all stored config; grep config files for 'http://' during setup reviews
- Normalize links when copying from browsers or docs — some sources emit http:// variants
- Add a startup assertion that all provider URLs are https, so misconfigurations fail before any fetch
- Never hardcode localhost http URLs in shared config; keep dev/test endpoints in separate settings
When it happens
Trigger: Calling any 4dayweek provider function with a URL whose scheme is 'http:' — most often a hand-written config entry 'http://4dayweek.io/...', a link copied from a page that downgraded the scheme, or legacy config predating the HTTPS requirement.
Common situations: portals.yml or docs containing an http:// link copied years ago; a proxy/dev environment rewriting https:// to http://; string manipulation that replaced the scheme; hardcoding localhost http URLs from local testing into shared config.
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
- 4dayweek: invalid URL
- arbeitnow: invalid URL
- arbeitnow: URL must use HTTPS
- comeet: invalid URL
- eightfold: URL must use HTTPS
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/c704aee728af0a80.
Report an issue: GitHub.
Appendix: source
Thrown at providers/4dayweek.mjs:55
if (parsed.protocol === 'https:' && parsed.hostname === TRUSTED_HOST) {
return { url: FEED_BASE };
}
} catch {
// Ignore malformed URLs; another provider may still claim the entry.
}
}
return null;
}
/** @param {string} url */
function assertFourDayUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`4dayweek: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`4dayweek: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`4dayweek: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
}
return url;
}
/** Resolve the page cap: a positive integer `max_pages` on the entry, capped. */
function resolveMaxPages(entry) {
const v = entry?.max_pages;
if (Number.isInteger(v) && v > 0) return Math.min(v, MAX_PAGES_CAP);
return DEFAULT_MAX_PAGES;
}
// NaN-safe: posted is epoch SECONDS → ms; anything non-finite yields undefined.
function toEpochMs(seconds) {
return Number.isFinite(seconds) ? seconds * 1000 : undefined;
}
View on GitHub (pinned to aac998c7ed)