[Question] "Cannot read property 'launch' of undefined"
See original GitHub issueHi Team,
I am playing with AWS Lambda and Playwright.
with “playwright-aws-lambda”: “^0.5.2”, “playwright-core”: “^1.0.1”, works fine
but with “playwright-aws-lambda”: “^0.5.2”, “playwright-core”: “^1.2.1”, does not work.
what could be a problem?
my Code:
const playwright = require('playwright-aws-lambda');
exports.handler = async (event, context) => {
let result = null;
let browser = null;
try {
const browser = await playwright.launchChromium();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(event.url || 'https://google.com');
console.log('Page title: ', await page.title());
} catch (error) {
throw error;
} finally {
if (browser !== null) {
await browser.close();
}
}
};
Error Message:
{
"errorType": "TypeError",
"errorMessage": "Cannot read property 'launch' of undefined",
"trace": [
"TypeError: Cannot read property 'launch' of undefined",
" at Object.launchChromium (/opt/node_modules/playwright-aws-lambda/dist/src/chromium.js:90:47)",
" at async Runtime.exports.handler (/var/task/api/poc1/handler.js:8:21)"
]
}
tnx a lot
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Puppeteer launcher error results with undefined - Stack Overflow
Works import Puppeteer, { Browser, PDFOptions } from "puppeteer"; browser = await Puppeteer.launch({}); // Doesn't work import { launch, ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >cannot read properties of undefined (reading 'locator') - You.com
There are 3 main reasons the "Cannot read properties of undefined" error occurs: Accessing a property on a variable that stores an undefined...
Read more >puppeteer-chat/Lobby - Gitter
... TypeError: Cannot read property 'toString' of undefined. i tried . ... my code works when i do const browser = await puppeteer.launch({headless:...
Read more >ERROR: Cannot read property 'split' of undefined (Docker ...
Hi, When i run the below code on my local N8N (npm installed) in function node , the code work fine and i...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing as dupe of https://github.com/microsoft/playwright/issues/2905
Hi Max,
I created new layer with:
package.json
Error:
an then i deleted “playwright-chromium”: “^1.2.1” from json file and uploaded new layer, with
this does not help.
am i doing something wrong?