JupiterOne / playwright-aws-lambda

Support for running Microsoft's Playwright on AWS Lambda and Google Cloud Functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't launch playwright-aws-lambda with a user profile

ua2028 opened this issue · comments

Using versions;
"playwright-aws-lambda": "^0.6.0",
"playwright-core": "^1.7.1",

Trying to run pl-aws-chrome with a specific user profile fails, 'launchPersistentContext' is not defined for pl-aws-chrome, and passing as args fail as well. Not sure how to solve this issue, could use some help

running

const playwrightAWS = require('playwright-aws-lambda');
chromium = await playwrightAWS.launchChromium({headless: true, userDataDir: './user_profiles/'});

will result with:

Uncaught:
Error: browserType.launch: userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead
    at Object.assert (SOME_PATH/node_modules/playwright-core/lib/utils/utils.js:80:15)
    at SOME_PATH/node_modules/playwright-core/lib/client/browserType.js:56:21
    at BrowserType._wrapApiCall (SOME_PATH/node_modules/playwright-core/lib/client/channelOwner.js:77:34)
    at BrowserType.launch (SOME_PATH/node_modules/playwright-core/lib/client/browserType.js:55:21)
    at Object.launchChromium (SOME_PATH/node_modules/playwright-aws-lambda/dist/src/chromium.js:97:47)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async repl:1:35

passing directory with profile flags in args:

chromium = await playwrightAWS.launchChromium({headless: true, args: ['--profile-directory=./user_profiles/', '--user-data-dir=./user_profiles/']});

Uncaught:
browserType.launch: Pass userDataDir parameter instead of specifying --user-data-dir argumentError