From dcc3e5294df8cde18b6fcdd59cfc280c1d08b42b Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Thu, 15 Aug 2024 22:43:49 +0530 Subject: [PATCH] fix: Update crawler.ts to log cookies --- backend/functions/src/cloud-functions/crawler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/functions/src/cloud-functions/crawler.ts b/backend/functions/src/cloud-functions/crawler.ts index a4a6cd0..c9a72b8 100644 --- a/backend/functions/src/cloud-functions/crawler.ts +++ b/backend/functions/src/cloud-functions/crawler.ts @@ -877,7 +877,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; this.threadLocal.set('timeout', opts.timeout * 1000); } - const cookies = req.headers['x-set-cookie'] ? + const cookies = req.headers['x-set-cookie'] ? (Array.isArray(req.headers['x-set-cookie']) ? req.headers['x-set-cookie'] : [req.headers['x-set-cookie']]) .map(cookie => { const [name, value] = cookie.split('='); @@ -885,6 +885,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; }) : []; + console.log('Cookies:', cookies); const crawlOpts: ExtraScrappingOptions = { proxyUrl: opts.proxyUrl, cookies: cookies,