feat: enhance crawl error diagnostics and configurable headers - #483
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
This commit adds configurable User-Agent support for crawls by exposing on CrawlRequest, and improves error visibility by yielding ScrapeData for pages that fail during a crawl, with an field mapped from the fetch error.
- CrawlRequest.headers now reaches every page fetch. /v1 accepts it flat or under scrapeOptions; /v2 reads scrapeOptions.headers and rejects a malformed value instead of silently dropping it. - A URL the crawl cannot read is returned marked through the existing block field rather than vanishing from the results array, so the caller learns which URL failed and why while completed minus blocked keeps it unbilled. Applied to transport failures, CDN origin errors, PDF conversion failures and extraction failures alike. - Link discovery compares the full origin, port included, matching the map path. A link on another port of the same host is no longer followed, which also stops the caller's headers reaching a different service. - A blocked document now reports zero credits on /v2 instead of one. The envelope total already excluded it; only the per-document field disagreed. - crw crawl reports the pages it returned and the unreadable ones separately instead of folding both into one count. - docs/docs/crawling.md and both OpenAPI copies document the new field, including the warning that a browser render applies headers to every subresource request.
8e364b3 to
ba12e8a
Compare
|
thanks for this, and sorry for the slow reply. both halves of the idea are right and worth having: a crawl that quietly drops the URLs it could not read is genuinely hard to debug, and the crawl path was passing an empty header map while i pushed a top-up commit to your branch ( it did not compile.
a few things your version surfaced that turned out to be older bugs, now fixed in the same commit since the headers field is what makes them bite:
also filled in: the placeholder is applied to PDF-conversion and extraction failures too, not just the two paths you touched, so the contract holds everywhere. and one note on tests. verified green locally on CI should go green now. thanks again for finding this one, it was a real gap. |
|
merged as heads up on timing: opencore is the engine, and a merge to main is not gated on a release. CI on main auto-bumps thanks for the report and the fix. the header gap was real, and chasing it down is what surfaced two older bugs we would not have found otherwise: the same-origin check had been dropping the port since forever, and blocked pages were reporting a credit they were never charged. both are fixed in the same commit. if you want another one, |
This PR adds configurable User-Agent headers to the Crawl request, and emits failed fetches as ScrapeData objects with an error field to improve visibility.