Apify and Crawlee Official Forum

Updated 4 months ago

Playwright - state.conditions.includes is not a function

I've done a new load to create a new actor using npx crawlee create app, then selecting the Playwright Typescript template. Once all npm packages have been loaded I then cd into app and tried npm start. I get the below error, I then tryied to download the crawlee playwright packages npm install crawlee playwright however I still have this issue trying to run the actor. I have not modified the template that is provided when using npx crawlee create. Any help or guidance is appreciated.

node_modules\typescript\lib\typescript.js:41322
if (condition === "default"

state.conditions.includes(condition)

isApplicableVersionedTypesKey(state.conditions, condition)) {
^

TypeError: state.conditions.includes is not a function
1
P
M
J
23 comments
Hi Thank you for reaching us. I am able to reproduce the issue and I will raise it internally, so it hopefully will be solved soon.
There currently seems to be something wrong with typescript v3
as a workaround you may set the typescript dependency in package.json to:
Plain Text
        "typescript": "~5.2.2"

And run npm install after.

Then I was able to run the template as usual.
We are currently working on fixing the version in our dependecies in templates.
Thanks for the update, I have gone ahead an specified version 5.2.2.
I have the same, and changed "typescript" but am not able to push it to Apify, it throws an error that i did not have before:
Property '[Symbol.asyncDispose]' is missing in type 'PlaywrightBrowser' but required in type 'Browser'.
2023-11-23T17:26:34.969Z 12 export declare class PlaywrightBrowser extends EventEmitter implements Browser {
2023-11-23T17:26:34.971Z ~~~2023-11-23T17:26:34.974Z node_modules/playwright-core/types/types.d.ts:16581:32023-11-23T17:26:34.976Z 16581 Symbol.asyncDispose: Promise<void>;2023-11-23T17:26:34.978Z ~~~~~~~~~
2023-11-23T17:26:34.980Z '[Symbol.asyncDispose]' is declared here.
2023-11-23T17:26:34.982Z Found 1 error in node_modules/@crawlee/browser-pool/playwright/playwright-browser.d.ts:12
just advanced to level 4! Thanks for your contributions! πŸŽ‰
Hmm, I cannot reproduce that, may you create a new project from template and compare the package.json and Dockerfile with your project?
my apify push succeeded with no further issues.
new project gives the same error, is it to do with the updated Crawlee ?
pushing to apify, this is the significant error:
2023-11-23T18:02:41.641Z '[Symbol.asyncDispose]' is declared here.
2023-11-23T18:02:41.642Z Found 1 error in node_modules/@crawlee/browser-pool/playwright/playwright-browser.d.ts:12
There is something out of sync, creating a boilerplate [playwright TS] app gives the [Symbol.asyncDispose] error. Then changing to Typescript 5.2 in packages solves it locally, but then pushing it to Apify it renders the same error.
What do you get for apify -v command?
apify-cli/0.19.1 win32-x64 node-v18.17.1
I got the same, what about npm -v typescript? Just to be sure..
10.2.4
Attachment
image.png
Is there the Build in the Apify Console, can you link it to me in personal message?
Hi Pepa, there you go
Thanks in advance
Pepa, while waiting any tricks to get it to build, its only 2 files. Insert it into a duplicated online actor ?
i made a copy of an other online actor, changed the code, that worked. for now.
I see, you are probably creating actor through crawlee create instead of apify create - which is what I tested (and recommend you to use it when Actors should run on Apify Platform). I was able to reproduce it now.

I will report this bug it internally.
THANKS!, but sorry, cannot keep the crawlee and apify apart with regards to functionality.
There is a new release of crawlee today 3.6.2 that should fix this issue.

Try npm i crawlee@3.6.2 and let me know if it helps - it worked for me πŸ™‚
wooop, just went the apify way, wiil try later.
Add a reply
Sign up and join the conversation on Discord