Apify Discord Mirror

Updated last year

Playwright & Typescript GCP Cloud Build Error

At a glance

The community member is experiencing a TypeScript error when deploying to GCP, specifically related to the PlaywrightBrowser class not implementing the required [Symbol.asyncDispose] property of the Browser interface. Another community member provided a solution by modifying the tsconfig.json file to ignore certain errors, such as noUnusedLocals, noUnusedParameters, and strict.

I am getting the following error in my build logs when deploying to GCP using the instructions from the documentation.

Is this a known issue? am I missing anything?

Plain Text
node_modules/@crawlee/browser-pool/playwright/playwright-browser.d.ts:12:22 - error TS2420: Class 'PlaywrightBrowser' incorrectly implements interface 'Browser'.
  Property '[Symbol.asyncDispose]' is missing in type 'PlaywrightBrowser' but required in type 'Browser'.

12 export declare class PlaywrightBrowser extends EventEmitter implements Browser {
                        ~~~~~~~~~~~~~~~~~

  node_modules/playwright-core/types/types.d.ts:16581:3
    16581   [Symbol.asyncDispose](): Promise<void>;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '[Symbol.asyncDispose]' is declared here.
T
1 comment
Fixed by ignoring the bulk of errors via my tsconfig.json

Specifically added the following (indicated by + sign) to the overrides...

Plain Text
        {
    "extends": "@apify/tsconfig",
    "compilerOptions": {
        "module": "ES2022",
        "target": "ES2022",
        "outDir": "dist",
        + "noUnusedLocals": false,
        + "noUnusedParameters": false,
        + "strict": false,
        "skipLibCheck": true,
        "lib": ["DOM"]
    },
    "include": [
        "./src/**/*"
    ]
}
Add a reply
Sign up and join the conversation on Discord