2024-06-13T04:28:54.490Z WARN ApifyClient: API request failed 4 times. Max attempts: 9. 2024-06-13T04:28:54.492Z Cause:ApifyApiError: You have exceeded the rate limit of 30 requests per second 2024-06-13T04:28:54.495Z clientMethod: RequestQueueClient.get 2024-06-13T04:28:54.497Z statusCode: 429 2024-06-13T04:28:54.498Z type: rate-limit-exceeded 2024-06-13T04:28:54.500Z attempt: 4 2024-06-13T04:28:54.504Z httpMethod: get 2024-06-13T04:28:54.505Z path: /v2/request-queues/tMiFOqCqVhLTL7QSK 2024-06-13T04:28:54.507Z stack: 2024-06-13T04:28:54.509Z at makeRequest (/home/myuser/node_modules/apify-client/dist/http_client.js:184:30) 2024-06-13T04:28:54.510Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-06-13T04:28:54.512Z at async RequestQueueClient._get (/home/myuser/node_modules/apify-client/dist/base/resource_client.js:25:30) 2024-06-13T04:28:54.514Z at async RequestQueue.open (/home/myuser/node_modules/@crawlee/core/storages/request_provider.js:614:34) 2024-06-13T04:28:54.516Z at async PuppeteerCrawler.getRequestQueue (/home/myuser/node_modules/@crawlee/basic/internals/basic-crawler.js:595:51) 2024-06-13T04:28:54.518Z at async PuppeteerCrawler.addRequests (/home/myuser/node_modules/@crawlee/basic/internals/basic-crawler.js:612:30)
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const SINGLE_FILES = [ 'single-file-bootstrap.js', 'single-file-frames.js', 'single-file-hooks-frames.js', 'single-file.js' ]; export const SINGLE_FILE_PATHS = SINGLE_FILES.map(file => path.join(__dirname, 'single-file', file)); export async function addScriptsToPage(page: Page) { try { for (const scriptPath of SINGLE_FILE_PATHS) { await page.addScriptTag({ path: scriptPath }); } } catch(e) { console.error('Error adding scripts to page', e); return { success: false, error: e }; } return { success: true }; }
.run()
. But the actor doesn't finish all 10 URLs. It will process between 4 and 7, then the Log for the run will just show statistics message repeated every second. 2024-05-22T22:34:24.274Z INFO Statistics: PlaywrightCrawler request statistics: {"requestAvgFailedDurationMillis":null,"requestAvgFinishedDurationMillis":35781,"requestsFinishedPerMinute":2,"requestsFailedPerMinute":0,"requestTotalDurationMillis":143124,"requestsTotal":4,"crawlerRuntimeMillis":120866,"retryHistogram":[4]} 2024-05-22T22:34:24.301Z INFO PlaywrightCrawler:AutoscaledPool: state {"currentConcurrency":6,"desiredConcurrency":11,"systemStatus":{"isSystemIdle":true,"memInfo":{"isOverloaded":false,"limitRatio":0.2,"actualRatio":0},"eventLoopInfo":{"isOverloaded":false,"limitRatio":0.6,"actualRatio":0},"cpuInfo":{"isOverloaded":false,"limitRatio":0.4,"actualRatio":0},"clientInfo":{"isOverloaded":false,"limitRatio":0.3,"actualRatio":0}}}
const run = await client.actor("xyz").call(input);
for (let input of inputs) { const run = await client.actor("xyz").call(input); }
preNavigationHooks: [ async ({ page }) => { // await page.setViewportSize({ width, height: 1080 }); await blocker.enableBlockingInPage(page); await page.setViewportSize(iPhone14ProMax.viewport); }, ],
PuppeteerCrawler
but can't get it to work. page.on('request', (req) => { // If the URL doesn't include our keyword, ignore it if (req.url().includes('bouncex')) { req.abort(); return; }; req.continue(); });
preNavigationHooks
like so:preNavigationHooks: [ async ({ page }, goToOptions) => { goToOptions!.waitUntil = "networkidle2"; goToOptions!.timeout = 3600000; await blocker.enableBlockingInPage(page); page.on('request', (req) => { // If the URL doesn't include our keyword, ignore it if (req.url().includes('bouncex')) { req.abort(); return; }; req.continue(); }); await page.setViewport(viewportConfig); }, ],
Error: Request is already handled!
PuppeteerCrawler
?