I am trying to run crawlee on aws lambda but getting this error message:
Reclaiming failed request back to the list or queue. Protocol error (Target.setAutoAttach): Target closed.
chromium version: 109
node version: 16
code:
exports.handler = async (event, context, callback) => {
const finalResult = [];
const url = ``;
try {
const crawler = new PuppeteerCrawler({
launchContext: {
useIncognitoPages: true,
launchOptions: {
executablePath: await chromium.executablePath(),
args: ['--no-sandbox', '--disable-setuid-sandbox']
},
launcher: puppeteer
},
useSessionPool: true,
requestHandlerTimeoutSecs: 60,
browserPoolOptions: {
useFingerprints: true,
fingerprintOptions: {
fingerprintGeneratorOptions: {
browsers: ['chrome'],
operatingSystems: ['windows'],
devices: ['desktop'],
locales: ['en-US', 'en']
},
},
},
headless: true,
async requestHandler({ request, page, enqueueLinks }) {
log.info(`Processing ${request.url}...`);
},
// This function is called if the page processing failed more than maxRequestRetries+1 times.
failedRequestHandler({ request }) {
log.error(`Request ${request.url} failed too many times.`);
},
});
// Run the crawler and wait for it to finish.
await crawler.run([url]);
log.info('Crawler finished.');
} catch (error) {
return callback(error);
} finally {
}
return callback(null, finalResult);
};