Apify and Crawlee Official Forum

Updated 3 months ago

how to set payload in cheerio crawler preNavigationHooks

doing it like this:
Plain Text
preNavigationHooks:[async (crawlingContext, gotOptions) => {
         const { request } = crawlingContext;
             request.payload = `.......`;
 }


does not work, error: ReferenceError: page is not defined
also when I want to set headers, should I use gotOptions.headers= or request.headers=
what is the difference?
L
A
H
4 comments
Looks like a bug, will tell team to check
Need to see full error stack since under Cheerio page not supposed to be used. I guess you might be setting payload for GET request and crawler gone wild.
As for headers - I using request.headers in one of the actors, works fine
so it was bug in my code πŸ€¦β€β™‚οΈ it has nothing to do with puppeteer page
I had payload like this .....${page} but it was too long and way out of the screen to notice it
Add a reply
Sign up and join the conversation on Discord