SourcesFetchFailedPayload sources.fetch.failed@1

Generated at from openvibe-contracts v0.33.0 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
sources
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-017
Schema
https://openvibe.network/contracts/events/payloads/sources.fetch.failed.v1.json

sources.fetch.failed v1 (OpenVibe.Sources server/ingest.js failedEvent). One endpoint fetch of a source failed and counts as a failure: robots denied or unreachable, an HTTP error, the site's 429, a parse error or an internal error. Not sent for 304, a disabled source, a missing credential or the local rate limit. No item is created or changed. Envelope: subject { type: source, id: <source_key> }, visibility internal, priority important, actor service:sources.

Fields

FieldTypeRequiredDescriptionConstraints
source_keystringyes
  • pattern ^[a-z0-9][a-z0-9-]{1,63}$
categoryenumyes
  • one of "news", "blog", "reviews", "deals", "coupons", "trade"
run_idstringyesThe recorded fetch run (GET /api/v1/sources/:key/runs).
  • pattern ^frn_[0-9A-HJKMNP-TV-Z]{26}$
endpoint_urlstringyes
  • minLength 1
  • maxLength 2048
stateenumyes
  • one of "robots_denied", "http_error", "rate_limited", "parse_error"
error_codestringyesrobots | address_refused | port_refused | bad_url | upstream_429 | http_<status> | unreadable | adapter_error | internal.
  • pattern ^[a-z][a-z0-9_]{1,39}$
http_statusinteger | nullyes
  • minimum 100
  • maximum 599
consecutive_failuresintegeryesThe source's consecutive failed runs including this one.
  • minimum 1

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: http-503
{
  "source_key": "bbc-world",
  "category": "news",
  "run_id": "frn_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "endpoint_url": "https://feeds.bbci.co.uk/news/world/rss.xml",
  "state": "http_error",
  "error_code": "http_503",
  "http_status": 503,
  "consecutive_failures": 2
}
Valid: robots-denied
{
  "source_key": "shop-sitemap",
  "category": "deals",
  "run_id": "frn_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "endpoint_url": "https://shop.example.com/sitemap.xml",
  "state": "robots_denied",
  "error_code": "robots",
  "http_status": null,
  "consecutive_failures": 1
}
Rejected: not-modified
{
  "source_key": "bbc-world",
  "category": "news",
  "run_id": "frn_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "endpoint_url": "https://feeds.bbci.co.uk/news/world/rss.xml",
  "state": "not_modified",
  "error_code": null,
  "http_status": 304,
  "consecutive_failures": 0
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('sources.fetch.failed@1', value);   // { valid, errors: [{ path, message }] }