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

Cannot read property 'launch' of undefined

jaradi opened this issue · comments

Tried integrating playwright-aws-lambda with an existing project and got an error, so went back to basics, started a new npm project and followed the steps in the README as follows:

  • npm install playwright-core playwright-aws-lambda --save
  • copied the example under the Usage section and pasted it into my index file.
  • uploaded my function to lambda with nodejs12.x runtime.

When running the lambda I get the following error:

ERROR	Invoke Error 	{"errorType":"TypeError","errorMessage":"Cannot read property 'launch' of undefined","stack":
["TypeError: Cannot read property 'launch' of undefined","    at Object.launchChromium (/var/task/node_modules/playwright-
aws-lambda/dist/src/chromium.js:90:47)","    at processTicksAndRejections (internal/process/task_queues.js:97:5)","    at 
async Runtime.exports.handler (/var/task/index.js:8:21)"]}

Apologies if this is user error. I did some research before logging this to see if there was an obvious fix, and simplified the repro process by using the bare minimum example code instead of my own code.

I'm having the same error, the versions that work for me is:

"playwright-aws-lambda": "^0.4.0",
"playwright-core": "^0.11.1",

But i need the newer version for the project that i'm working on

I having the same issue.

"playwright-aws-lambda": "^0.8.0",
"playwright-core": "^1.22.2",

same here

Similar issue with

"playwright-aws-lambda": "^0.8.0",
"playwright-core": "^1.23.3",

TypeError: Cannot read properties of undefined (reading 'launchChromium')

Did anyone manage to workaround it?

Same here

same here

same here

hi all, ran into the same issue here. Was able to fix it by:

import { launchChromium } from 'playwright-aws-lambda/dist/src';

hi all, ran into the same issue here. Was able to fix it by:

import { launchChromium } from 'playwright-aws-lambda/dist/src';

This fixed it for me too.

also you can fix like this

import * as playwright from 'playwright-aws-lambda';