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

Lambda nodejs22.x fails #318

Closed
joergbaier opened this issue Nov 22, 2024 · 10 comments
Closed

Lambda nodejs22.x fails #318

joergbaier opened this issue Nov 22, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@joergbaier
Copy link

Error
Failed to launch the browser process!
/tmp/chromium: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory

Environment

  • @sparticuz/chromium Version: "~130.0.0" = "130.0.0"
  • puppeteer-core Version: "~23.7.0" = "23.7.1"
  • Node.js Version: 22.11.0
  • Lambda / GCF Runtime: nodejs22.x

I will investigate more later, and will retry with the latest @sparticuz/chromium & puppeteer-core combo.

@joergbaier joergbaier added the bug Something isn't working label Nov 22, 2024
@Sparticuz
Copy link
Owner

I will most likely need to add in support for node 22 in the 'is this a lambda environment' function

@xmimiex
Copy link

xmimiex commented Nov 23, 2024

same bug with "playwright-core", I can reproduce on a Vercel Serverless environment

@Sparticuz
Copy link
Owner

Do you have any documentation about Vercel serverless functions being moved to node 22? Most likely the issue is that it's not being correctly detected as a lambda environment. If you can find environment variables that would let me detect the environment we can get that added but I don't believe that is related to node 22, as the node 22 stable environments on lambda have only been out a few days

@xmimiex
Copy link

xmimiex commented Nov 23, 2024

which environment variables do you need exactly ? there are a lot ...

I can quickly see :

  • AWS_EXECUTION_ENV: 'AWS_Lambda_nodejs20.x' // AWS_EXECUTION_ENV: 'AWS_Lambda_nodejs22.x',
  • LAMBDA_RUNTIME_DIR: '/var/runtime', // LAMBDA_RUNTIME_DIR: '/var/runtime',

@philiiiiiipp
Copy link

I adjusted the functions #319

@philiiiiiipp
Copy link

I tried using it with the adjusted function but I am running into

Error: The input directory "/var/task/functions/bin" does not exist.
    at Function.executablePath (/node_modules/@sparticuz/chromium/build/index.js:235:19)

Maybe this has been adjusted in node22, I will further investigate.

@philiiiiiipp
Copy link

I hardcoded the path for extraction which worked but now the next issue arises

ERROR	[ERROR]:  Error: spawn ETXTBSY
    at ChildProcess.spawn (node:internal/child_process:420:11)
    at Object.spawn (node:child_process:759:9)
    at new Process (/node_modules/@puppeteer/browsers/src/launch.ts:292:41)
    at launch (/node_modules/@puppeteer/browsers/src/launch.ts:173:10)
    at tre.launch (/node_modules/puppeteer-core/src/node/BrowserLauncher.ts:142:28)
    at generatePdf ...
  errno: -26,
  code: 'ETXTBSY',
  syscall: 'spawn'
} 

Maybe node22 in lambda environments is not so straighforward or I am missing something (which I hope I do 😄). Ill let it rest for now.

@philiiiiiipp
Copy link

I did some more investigation, seems like I just had a bug before. I can now successfullt read a website.

I had to hardcode the paths (in my case to the lambda layer) though. Could be that this changed in node22 to how it was before. Let me know if you want me to take a closer look or if you will take it from here 😊

@KROSF
Copy link

KROSF commented Nov 25, 2024

in my case i got the following error

2024-11-25T09:19:19.984Z	7e4b98d1-f6fe-4b8f-a4cc-ea980b566d9c	ERROR	Invoke Error 	{
    "errorType": "LT",
    "errorMessage": "Target page, context or browser has been closed\nBrowser logs:\n\n<launching> /tmp/chromium --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,PlzDedicatedWorker --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --headless=old --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --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 --font-render-hinting=none --disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints,AudioServiceOutOfProcess,IsolateOrigins,site-per-process --enable-features=NetworkServiceInProcess2,SharedArrayBuffer --hide-scrollbars --ignore-gpu-blocklist --in-process-gpu --window-size=1920,1080 --use-gl=angle --use-angle=swiftshader --allow-running-insecure-content --disable-setuid-sandbox --disable-site-isolation-trials --disable-web-security --no-sandbox --no-zygote --headless --user-data-dir=/tmp/playwright_chromiumdev_profile-iNShsX --remote-debugging-pipe --no-startup-window\n<launched> pid=14\n[pid=14][err] /tmp/chromium: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory\n[pid=14] <process did exit: exitCode=127, signal=null>\n[pid=14] starting temporary directories cleanup\nCall log:\n  - <launching> /tmp/chromium --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,PlzDedicatedWorker --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --headless=old --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --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 --font-render-hinting=none --disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints,AudioServiceOutOfProcess,IsolateOrigins,site-per-process --enable-features=NetworkServiceInProcess2,SharedArrayBuffer --hide-scrollbars --ignore-gpu-blocklist --in-process-gpu --window-size=1920,1080 --use-gl=angle --use-angle=swiftshader --allow-running-insecure-content --disable-setuid-sandbox --disable-site-isolation-trials --disable-web-security --no-sandbox --no-zygote --headless --user-data-dir=/tmp/playwright_chromiumdev_profile-iNShsX --remote-debugging-pipe --no-startup-window\n  - <launched> pid=14\n  - [pid=14][err] /tmp/chromium: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory\n  - [pid=14] <process did exit: exitCode=127, signal=null>\n  - [pid=14] starting temporary directories cleanup\n",
    "name": "LT",
    "stack": [
        ""
    ]
}

@Sparticuz
Copy link
Owner

closed in #320

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

5 participants