Apify & CrawleeA&CApify & Crawlee
Powered by
MatzeM
Apify & Crawlee•2y ago•
4 replies
Matze

Bind session and proxy together

Hi,
I have a small problem, my sessions and proxies don't stay together, which I expected to be the default.

new PlaywrightCrawler({
 ...
  useSessionPool: true,
  sessionPoolOptions: {
    blockedStatusCodes: [403],
    sessionOptions: {
      maxErrorScore: 1,
      maxUsageCount: 7
    }
  },
  proxyConfiguration: new ProxyConfiguration({ proxyUrls: proxyList() }), // List of 250 Proxies
...
})
new PlaywrightCrawler({
 ...
  useSessionPool: true,
  sessionPoolOptions: {
    blockedStatusCodes: [403],
    sessionOptions: {
      maxErrorScore: 1,
      maxUsageCount: 7
    }
  },
  proxyConfiguration: new ProxyConfiguration({ proxyUrls: proxyList() }), // List of 250 Proxies
...
})

When I log the session id and port from the list in my router, the proxy.sessionId does not match the session.id.
 log.info(session?.id)
 log.info(proxyInfo?.port)
 log.info(proxyInfo?.sessionId)
 log.info(session?.id)
 log.info(proxyInfo?.port)
 log.info(proxyInfo?.sessionId)


Results look like:
INFO  PlaywrightCrawler: session_AlZoomLhQU
INFO  PlaywrightCrawler: 10209
INFO  PlaywrightCrawler: session_Dnha2MhDeX
....
INFO  PlaywrightCrawler: session_AlZoomLhQU
INFO  PlaywrightCrawler: 10208
INFO  PlaywrightCrawler: session_6jOviCJSHt
...
INFO  PlaywrightCrawler: session_AlZoomLhQU
INFO  PlaywrightCrawler: 10209
INFO  PlaywrightCrawler: session_Dnha2MhDeX
....
INFO  PlaywrightCrawler: session_AlZoomLhQU
INFO  PlaywrightCrawler: 10208
INFO  PlaywrightCrawler: session_6jOviCJSHt
...


I don't know if the session may change afterwards after the proxy is assigned:
* https://github.com/apify/crawlee/blob/master/packages/browser-crawler/src/internals/browser-crawler.ts#L504
* https://github.com/apify/crawlee/blob/master/packages/browser-crawler/src/internals/browser-crawler.ts#L534
Apify & Crawlee banner
Apify & CrawleeJoin
This is the official developer community of Apify and Crawlee.
14,091Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
ellativity

**Update to Store Publishing Terms and Acceptable Use Policy** Due to an influx of fraudulent reviews recently, Apify's Legal team has taken some actions to protect developers, customers, and Apify, by updating the Store Publishing Terms and Acceptable Use Policy. Please pay special attention to the updated terms in section 4 of the Store Publishing Terms here: https://docs.apify.com/legal/store-publishing-terms-and-conditions Additionally, please review the changes to section 2 of the Acceptable Use Policy here: https://docs.apify.com/legal/acceptable-use-policy If you have any questions, please ask them in <#1206131794261315594> so everyone can see the discussion. Thanks!

ellativity · 3w ago

ellativity

Hi @everyone I'm hanging out with the Creator team at Apify in https://discord.com/channels/801163717915574323/1430491198145167371 if you want to discuss Analytics and Insights!

ellativity · 4w ago

ellativity

2 things for <@&1092713625141137429> members today: 1. The Apify developer rewards program is open for registrations: https://apify.notion.site/developer-rewards This is the program where you will earn points for marketing activities. The rewards are still TBC, but the real purpose of the program is to help you structure your marketing activities and efforts. In the coming weeks, I will be populating that link with guides to help you identify the best ways to market your Actors, as well as scheduling workshops and office hours to help you create content and develop your own marketing strategy. 2. At 2PM CET (in about 80 minutes) there will be an office hour with the team behind Insights and Analytics, who want your feedback on how to improve analytics for you. Join us in https://discord.com/channels/801163717915574323/1430491198145167371 to share your ideas!

ellativity · 4w ago

Similar Threads

setCookie and session.getCookies don't work together
NeoNomadeNNeoNomade / crawlee-js
3y ago
bind launch-context(timezone,locale) with proxy
military-pinkMmilitary-pink / crawlee-js
3y ago
playwright and proxy problem
HonzaSHHonzaS / crawlee-js
3y ago
proxy issues
scornful-crimsonSscornful-crimson / crawlee-js
2y ago