@detiq/crawler 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/crawler.ts +6 -3
package/package.json
CHANGED
package/src/crawler.ts
CHANGED
|
@@ -978,11 +978,14 @@ export async function crawlProject(opts: {
|
|
|
978
978
|
// Non-fatal — crawl proceeds without API endpoint capture
|
|
979
979
|
}
|
|
980
980
|
// Final fallback: if rawPage is still null, use the Stagehand page (events may not work)
|
|
981
|
-
if (!rawPage)
|
|
981
|
+
if (!rawPage) {
|
|
982
|
+
rawPage = page;
|
|
983
|
+
logger.warn('[crawler] rawPage fell back to Stagehand proxy — CDP connectOverCDP failed; route() calls will be skipped');
|
|
984
|
+
}
|
|
982
985
|
|
|
983
986
|
// ── HTTP Basic Auth: inject Authorization header for same-origin requests ───
|
|
984
987
|
// Must use rawPage (real Playwright page) — Stagehand V3Page proxy does not implement route().
|
|
985
|
-
if (opts.httpBasicUsername && opts.httpBasicPassword) {
|
|
988
|
+
if (opts.httpBasicUsername && opts.httpBasicPassword && typeof rawPage?.route === 'function') {
|
|
986
989
|
const encoded = Buffer.from(`${opts.httpBasicUsername}:${opts.httpBasicPassword}`).toString('base64');
|
|
987
990
|
const appOrigin = new URL(opts.appUrl).origin;
|
|
988
991
|
await rawPage.route('**/*', (route: any) => {
|
|
@@ -1002,7 +1005,7 @@ export async function crawlProject(opts: {
|
|
|
1002
1005
|
// the crawler during long crawl sessions. The API verifies the secret before
|
|
1003
1006
|
// skipping the limiter.
|
|
1004
1007
|
const crawlerSecret = process.env.CRAWLER_INTERNAL_SECRET;
|
|
1005
|
-
if (crawlerSecret) {
|
|
1008
|
+
if (crawlerSecret && typeof rawPage?.route === 'function') {
|
|
1006
1009
|
const loginPattern = `${new URL(opts.appUrl).origin}**/auth/login*`;
|
|
1007
1010
|
await rawPage.route(loginPattern, (route: any) => {
|
|
1008
1011
|
route.continue({
|