Skip to content

Unable to run puppeteer or playwright examples #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
agnieszka-ziaja opened this issue Mar 10, 2025 · 2 comments
Open

Unable to run puppeteer or playwright examples #2

agnieszka-ziaja opened this issue Mar 10, 2025 · 2 comments

Comments

@agnieszka-ziaja
Copy link

After following the workaround listed here #1 (comment) I can finally get the function to invoke, but it fails to run puppeteer or playwright examples.

Puppeteer error:

INFO	Launching Puppeteer browser with options: {"args":["--allow-pre-commit-input","--disable-background-networking","--disable-background-timer-throttling","--disable-backgrounding-occluded-windows","--disable-breakpad","--disable-client-side-phishing-detection","--disable-component-extensions-with-background-pages","--disable-component-update","--disable-default-apps","--disable-dev-shm-usage","--disable-extensions","--disable-hang-monitor","--disable-ipc-flooding-protection","--disable-popup-blocking","--disable-prompt-on-repost","--disable-renderer-backgrounding","--disable-sync","--enable-automation","--enable-blink-features=IdleDetection","--export-tagged-pdf","--force-color-profile=srgb","--metrics-recording-only","--no-first-run","--password-store=basic","--use-mock-keychain","--disable-domain-reliability","--disable-print-preview","--disable-speech-api","--disk-cache-size=33554432","--mute-audio","--no-default-browser-check","--no-pings","--single-process","--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints,AudioServiceOutOfProcess","--enable-features=NetworkServiceInProcess2,SharedArrayBuffer","--hide-scrollbars","--ignore-gpu-blocklist","--in-process-gpu","--window-size=1920,1080","--use-gl=angle","--use-angle=swiftshader-webgl","--disable-setuid-sandbox","--no-sandbox","--no-zygote","--headless"],"defaultViewport":{"deviceScaleFactor":1,"hasTouch":false,"height":1080,"isLandscape":true,"isMobile":false,"width":1920},"headless":true}
ERROR	Failed to launch Puppeteer browser, retrying Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
    at assert (/opt/nodejs/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15)
    at ChromeLauncher.computeLaunchArguments (/opt/nodejs/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:102:36)
    at async ChromeLauncher.launch (/opt/nodejs/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:70:28)
    at async launchBrowserWithRetries (/opt/nodejs/node_modules/Utils.js:37:20)
    at async Synthetics.launch (/opt/nodejs/node_modules/Synthetics.js:1190:29)
    at async Runtime.handler (/var/task/cw-synthetics.js:58:9)

Playwright error:

[info] Invoking /opt/index.handler (nodejs20.x)
[info] Error: An error occurred (InvalidParameterValueException) when calling the GetLayerVersion operation:
Invalid Layer name: arn:aws:lambda:us-west-2:760325925879:layer:AWS-CW-SyntheticsNodeJsPlaywright

I don't see anywhere to configure puppeteer to set the missing executablePath or channel values, and I think the missing playwright layer comes from your side as I don't recognise the AWS account ID 760325925879.

@jg-par
Copy link

jg-par commented Mar 19, 2025

+1

@swasts
Copy link
Collaborator

swasts commented Mar 21, 2025

  1. About puppeteer error, Are you using default script heartbeat-canary.js script or launching your own browser in script. How are you launching a new browser?
  2. About playwright error, template included in this sample repo uses synthetics layer in us-west-2. You need to either set your default region as us-west-2 or pass region in launch arguments so that sam attempts to download layer from the correct region.

You can set default region by:

export AWS_DEFAULT_REGION=us-east-2

You can pass the region at invoke time as well:

sam local invoke NodeJSPlaywrightCanary -e ../event.json --region us-west-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants