Skip to content
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

[BUG]throw an err :Navigating frame was detached in aws lambda #206

Closed
Forktechai opened this issue Dec 20, 2023 · 6 comments
Closed

[BUG]throw an err :Navigating frame was detached in aws lambda #206

Forktechai opened this issue Dec 20, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@Forktechai
Copy link

Forktechai commented Dec 20, 2023

chromium Version:116
puppeteer / puppeteer-core Version:21.1.0
Node.js Version:16
Lambda / GCF Runtime: public.ecr.aws/lambda/nodejs:16

page.goto(url, { waitUntil: 'networkidle0' }) threw the following exception:

2023-12-20T01:39:55.514Z 4e30b7ef-9859-4639-a518-b05b3e9cf52f ERROR Error: Navigating frame was detached
at LifecycleWatcher.#onFrameDetached (/var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:47)
at /var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:1:269
at Array.map ()
at Object.emit (/var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:1:252)
at Frame.emit (/var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:88:22)
at FrameManager.#removeFramesRecursively (/var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js:394:15)
at /var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js:90:46
at onceHandler (/var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:99:13)
at /var/task/node_modules/.pnpm/[email protected]/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:1:269
at Array.map ()

but when i use the base image public.ecr.aws/lambda/nodejs:16.2023.11.10.17 , it works well.

@Forktechai Forktechai added the bug Something isn't working label Dec 20, 2023
@Forktechai Forktechai changed the title [BUG]throw an err :Navigating frame was detached [BUG]throw an err :Navigating frame was detached in aws lambda Dec 20, 2023
@Sparticuz
Copy link
Owner

You'll need to update to 119.0.2 to get the new libs package.

@Prinzhorn
Copy link

I'm just in the process of migrating from an ancient chrome-aws-lambda and seeing the same error with page.goto. I tried @sparticuz/[email protected] with both [email protected] and [email protected]. According to https://pptr.dev/chromium-support one of them should definitely work or no?

@steadweb
Copy link

I've also seen this issue, we're currently seeing issues with libnss3 which may have been updated in the latest node:16 AWS lambda runtime image.

If you're bundling your own code in a docker image and running that on lambda, can you try the following in your Dockerfile:

FROM public.ecr.aws/lambda/nodejs:16.2023.11.18.13

Reverting back to an older node:16 version that hasn't updated libnss3 for us, works.

@rdsedmundo
Copy link

We're also seeing the same with latest @sparticuz/chromium and puppeteer-core.

@yoeven
Copy link

yoeven commented Jan 30, 2024

I had the same issue and have been on it for the entire day. it seems to be something related with the browser data being created in the /tmp directory being shared between lambda function. await browser.close() would technically clean up any data without affecting the next run but calling await browser.close() stalls sometimes. Here are something I did to fix it:

  • Upgrade puppeteer-core to "puppeteer-core": "^21.10.0"
  • Upgraded @sparticuz/chromium to "@sparticuz/chromium": "^121.0.0"
  • call await browser.close() at the end of the function like this await Promise.race([browser.close(), browser.close(), browser.close()]); so that if one call hangs most of the time the others would work to continue the process
  • remember to call await browser.close() even when your script throws errors for another reason, always close the browser before responding with a status

@alexander-dermicus
Copy link

Potentially related (with fix): #229 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants