dependent-tan
dependent-tan2y ago

Typescript Error using type `PlaywrightRequestHandler` in the latest Crawlee version

Just upgraded to 3.8.0 and my build process throws errors. Was working just fine before. What am I missing?
const xyzHandler: PlaywrightRequestHandler = async ({ request, page, enqueueLinks }) => {
}

const router = createPlaywrightRouter()
router.addHandler('xyz', xyzHandler)
const xyzHandler: PlaywrightRequestHandler = async ({ request, page, enqueueLinks }) => {
}

const router = createPlaywrightRouter()
router.addHandler('xyz', xyzHandler)
Argument of type 'PlaywrightRequestHandler' is not assignable to parameter of type '(ctx: Omit<PlaywrightCrawlingContext<Dictionary>, "request"> & { request: Request<Dictionary>; }) => Awaitable<...>'.
Types of parameters 'inputs' and 'ctx' are incompatible.
Type 'Omit<PlaywrightCrawlingContext<Dictionary>, "request"> & { request: Request<Dictionary>; }' is missing the following properties from type 'PlaywrightCrawlingContext<Dictionary>': browserController, page, id, crawler, and 16 more.ts(2345)
Argument of type 'PlaywrightRequestHandler' is not assignable to parameter of type '(ctx: Omit<PlaywrightCrawlingContext<Dictionary>, "request"> & { request: Request<Dictionary>; }) => Awaitable<...>'.
Types of parameters 'inputs' and 'ctx' are incompatible.
Type 'Omit<PlaywrightCrawlingContext<Dictionary>, "request"> & { request: Request<Dictionary>; }' is missing the following properties from type 'PlaywrightCrawlingContext<Dictionary>': browserController, page, id, crawler, and 16 more.ts(2345)
Even doing something like router.addHandler('xyz', async ({ request, page, enqueueLinks }) => {}) just gets the request type, page and enqueueLinks are unknown.
2 Replies
Oleg V.
Oleg V.2y ago
Hi, Thanks for reporting. We are aware of it and the fix is on the way) For now, You can roll back to crawlee 3.7
dependent-tan
dependent-tanOP2y ago
Alright, cheers.

Did you find this page helpful?