Skip to content

Unable to run in AWS lambda #27775

Description

@Dolov

i use my mac m1 build docker image, docker build --platform linux/amd64 -t playwright-lambda . it work good on my mac, but wrong on aws lambda,here are the errors reported on AWS lambda, Looking forward to receiving your reply。

2023-10-24T14:10:12.571Z	9ae667af-dc07-49cd-9233-df32424bd357	ERROR	Invoke Error 	{
    "errorType": "Error",
    "errorMessage": "browser.newPage: Browser closed.\n==================== Browser output: ====================\n<launching> /ms-playwright/chromium-1067/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --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 --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 --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-erwGil --remote-debugging-pipe --no-startup-window\n<launched> pid=111\n[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed\n[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed\n[pid=111][err] [1024/141011.624593:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] Fontconfig error: No writable cache directories\n[pid=111][err] [1024/141011.780980:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory\n[pid=111][err] [1024/141011.781034:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory\n[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed\n[pid=111][err] [1024/141011.842916:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.\n[pid=111][err] [1024/141011.843611:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.843723:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 1 time(s)\n[pid=111][err] [1024/141011.849380:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.849493:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 2 time(s)\n[pid=111][err] [1024/141011.851067:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.851168:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 3 time(s)\n[pid=111][err] [1024/141011.852557:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.852568:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 4 time(s)\n[pid=111][err] [1024/141011.854428:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.854438:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 5 time(s)\n[pid=111][err] [1024/141011.854963:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.854972:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 6 time(s)\n[pid=111][err] [1024/141011.856800:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.856811:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 7 time(s)\n[pid=111][err] [1024/141011.858983:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141011.858992:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 8 time(s)\n[pid=111][err] [1024/141012.245227:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002\n[pid=111][err] [1024/141012.245250:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 9 time(s)\n[pid=111][err] [1024/141012.245449:FATAL:gpu_data_manager_impl_private.cc(431)] GPU process isn't usable. Goodbye.\n[pid=111][err] #0 0x55c7354d8ef2 base::debug::CollectStackTrace()\n[pid=111][err] #1 0x55c7354c6263 base::debug::StackTrace::StackTrace()\n[pid=111][err] #2 0x55c73541a504 logging::LogMessage::~LogMessage()\n[pid=111][err] #3 0x55c7336101e7 content::(anonymous namespace)::IntentionallyCrashBrowserForUnusableGpuProcess()\n[pid=111][err] #4 0x55c73360ccc1 content::GpuDataManagerImplPrivate::FallBackToNextGpuMode()\n[pid=111][err] #5 0x55c73360b8fb content::GpuDataManagerImpl::FallBackToNextGpuMode()\n[pid=111][err] #6 0x55c733618002 content::GpuProcessHost::RecordProcessCrash()\n[pid=111][err] #7 0x55c733619414 content::GpuProcessHost::OnProcessLaunchFailed()\n[pid=111][err] #8 0x55c73340a5d1 content::BrowserChildProcessHostImpl::OnProcessLaunchFailed()\n[pid=111][err] #9 0x55c733485bb2 content::internal::ChildProcessLauncherHelper::PostLaunchOnClientThread()\n[pid=111][err] #10 0x55c733485f2b base::internal::FunctorTraits<>::Invoke<>()\n[pid=111][err] #11 0x55c735468a74 base::TaskAnnotator::RunTaskImpl()\n[pid=111][err] #12 0x55c73548303f base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()\n[pid=111][err] #13 0x55c735482ab9 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()\n[pid=111][err] #14 0x55c735483515 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()\n[pid=111][err] #15 0x55c7354ec7ae base::MessagePumpGlib::HandleDispatch()\n[pid=111][err] #16 0x55c7354ed0bd base::(anonymous namespace)::WorkSourceDispatch()\n[pid=111][err] #17 0x7f87d5b73d3b g_main_context_dispatch\n[pid=111][err] #18 0x7f87d5bc86c8 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4+0xaa6c7)\n[pid=111][err] #19 0x7f87d5b713e3 g_main_context_iteration\n[pid=111][err] #20 0x55c7354ec98a base::MessagePumpGlib::Run()\n[pid=111][err] #21 0x55c735483889 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run()\n[pid=111][err] #22 0x55c735449716 base::RunLoop::Run()\n[pid=111][err] #23 0x55c73342dfb3 content::BrowserMainLoop::RunMainMessageLoop()\n[pid=111][err] #24 0x55c73342fab2 content::BrowserMainRunnerImpl::Run()\n[pid=111][err] #25 0x55c73b5ea6fd headless::HeadlessContentMainDelegate::RunProcess()\n[pid=111][err] #26 0x55c7348ce1e2 content::RunBrowserProcessMain()\n[pid=111][err] #27 0x55c7348cfb84 content::ContentMainRunnerImpl::RunBrowser()\n[pid=111][err] #28 0x55c7348cf976 content::ContentMainRunnerImpl::Run()\n[pid=111][err] #29 0x55c7348ccf30 content::RunContentProcess()\n[pid=111][err] #30 0x55c7348cd15d content::ContentMain()\n[pid=111][err] #31 0x55c734f3e21e headless::HeadlessShellMain()\n[pid=111][err] #32 0x55c731098265 ChromeMain\n[pid=111][err] #33 0x7f87d4e15d90 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)\n[pid=111][err] #34 0x7f87d4e15e40 __libc_start_main\n[pid=111][err] #35 0x55c73109802a _start\n[pid=111][err] Task trace:\n[pid=111][err] #0 0x55c733485a3f content::internal::ChildProcessLauncherHelper::PostLaunchOnLauncherThread()\n[pid=111][err] #1 0x55c733485258 content::internal::ChildProcessLauncherHelper::StartLaunchOnClientThread()\n[pid=111][err] #2 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()\n[pid=111][err] #3 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()\n[pid=111][err] #4 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()\n[pid=111][err] Task trace buffer limit hit, update PendingTask::kTaskBacktraceLength to increase.\n[pid=111][err] ",
    "name": "Error",
    "stack": [
        "browser.newPage: Browser closed.",
        "==================== Browser output: ====================",
        "<launching> /ms-playwright/chromium-1067/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --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 --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 --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-erwGil --remote-debugging-pipe --no-startup-window",
        "<launched> pid=111",
        "[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed",
        "[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed",
        "[pid=111][err] [1024/141011.624593:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] Fontconfig error: No writable cache directories",
        "[pid=111][err] [1024/141011.780980:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory",
        "[pid=111][err] [1024/141011.781034:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory",
        "[pid=111][err] prctl(PR_SET_NO_NEW_PRIVS) failed",
        "[pid=111][err] [1024/141011.842916:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.",
        "[pid=111][err] [1024/141011.843611:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.843723:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 1 time(s)",
        "[pid=111][err] [1024/141011.849380:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.849493:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 2 time(s)",
        "[pid=111][err] [1024/141011.851067:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.851168:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 3 time(s)",
        "[pid=111][err] [1024/141011.852557:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.852568:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 4 time(s)",
        "[pid=111][err] [1024/141011.854428:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.854438:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 5 time(s)",
        "[pid=111][err] [1024/141011.854963:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.854972:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 6 time(s)",
        "[pid=111][err] [1024/141011.856800:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.856811:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 7 time(s)",
        "[pid=111][err] [1024/141011.858983:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141011.858992:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 8 time(s)",
        "[pid=111][err] [1024/141012.245227:ERROR:gpu_process_host.cc(946)] GPU process launch failed: error_code=1002",
        "[pid=111][err] [1024/141012.245250:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 9 time(s)",
        "[pid=111][err] [1024/141012.245449:FATAL:gpu_data_manager_impl_private.cc(431)] GPU process isn't usable. Goodbye.",
        "[pid=111][err] #0 0x55c7354d8ef2 base::debug::CollectStackTrace()",
        "[pid=111][err] #1 0x55c7354c6263 base::debug::StackTrace::StackTrace()",
        "[pid=111][err] #2 0x55c73541a504 logging::LogMessage::~LogMessage()",
        "[pid=111][err] #3 0x55c7336101e7 content::(anonymous namespace)::IntentionallyCrashBrowserForUnusableGpuProcess()",
        "[pid=111][err] #4 0x55c73360ccc1 content::GpuDataManagerImplPrivate::FallBackToNextGpuMode()",
        "[pid=111][err] #5 0x55c73360b8fb content::GpuDataManagerImpl::FallBackToNextGpuMode()",
        "[pid=111][err] #6 0x55c733618002 content::GpuProcessHost::RecordProcessCrash()",
        "[pid=111][err] #7 0x55c733619414 content::GpuProcessHost::OnProcessLaunchFailed()",
        "[pid=111][err] #8 0x55c73340a5d1 content::BrowserChildProcessHostImpl::OnProcessLaunchFailed()",
        "[pid=111][err] #9 0x55c733485bb2 content::internal::ChildProcessLauncherHelper::PostLaunchOnClientThread()",
        "[pid=111][err] #10 0x55c733485f2b base::internal::FunctorTraits<>::Invoke<>()",
        "[pid=111][err] #11 0x55c735468a74 base::TaskAnnotator::RunTaskImpl()",
        "[pid=111][err] #12 0x55c73548303f base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()",
        "[pid=111][err] #13 0x55c735482ab9 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()",
        "[pid=111][err] #14 0x55c735483515 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()",
        "[pid=111][err] #15 0x55c7354ec7ae base::MessagePumpGlib::HandleDispatch()",
        "[pid=111][err] #16 0x55c7354ed0bd base::(anonymous namespace)::WorkSourceDispatch()",
        "[pid=111][err] #17 0x7f87d5b73d3b g_main_context_dispatch",
        "[pid=111][err] #18 0x7f87d5bc86c8 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4+0xaa6c7)",
        "[pid=111][err] #19 0x7f87d5b713e3 g_main_context_iteration",
        "[pid=111][err] #20 0x55c7354ec98a base::MessagePumpGlib::Run()",
        "[pid=111][err] #21 0x55c735483889 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run()",
        "[pid=111][err] #22 0x55c735449716 base::RunLoop::Run()",
        "[pid=111][err] #23 0x55c73342dfb3 content::BrowserMainLoop::RunMainMessageLoop()",
        "[pid=111][err] #24 0x55c73342fab2 content::BrowserMainRunnerImpl::Run()",
        "[pid=111][err] #25 0x55c73b5ea6fd headless::HeadlessContentMainDelegate::RunProcess()",
        "[pid=111][err] #26 0x55c7348ce1e2 content::RunBrowserProcessMain()",
        "[pid=111][err] #27 0x55c7348cfb84 content::ContentMainRunnerImpl::RunBrowser()",
        "[pid=111][err] #28 0x55c7348cf976 content::ContentMainRunnerImpl::Run()",
        "[pid=111][err] #29 0x55c7348ccf30 content::RunContentProcess()",
        "[pid=111][err] #30 0x55c7348cd15d content::ContentMain()",
        "[pid=111][err] #31 0x55c734f3e21e headless::HeadlessShellMain()",
        "[pid=111][err] #32 0x55c731098265 ChromeMain",
        "[pid=111][err] #33 0x7f87d4e15d90 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)",
        "[pid=111][err] #34 0x7f87d4e15e40 __libc_start_main",
        "[pid=111][err] #35 0x55c73109802a _start",
        "[pid=111][err] Task trace:",
        "[pid=111][err] #0 0x55c733485a3f content::internal::ChildProcessLauncherHelper::PostLaunchOnLauncherThread()",
        "[pid=111][err] #1 0x55c733485258 content::internal::ChildProcessLauncherHelper::StartLaunchOnClientThread()",
        "[pid=111][err] #2 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()",
        "[pid=111][err] #3 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()",
        "[pid=111][err] #4 0x55c73603b198 mojo::SimpleWatcher::Context::Notify()",
        "[pid=111][err] Task trace buffer limit hit, update PendingTask::kTaskBacktraceLength to increase.",
        "[pid=111][err] ",
        "    at Runtime.handler (/APP/index.js:19:30)"
    ]
}


System info

  • Playwright Version: v1.35.0-jammy
  • Operating System: aws lambda
  • Browser: Chromium
  • Other info:

Source code

const {
chromium
} = require('@playwright/test')

const handler = async () => {
const browser = await chromium.launch({
headless: true
})

const page = await browser.newPage()
await page.goto('https://baidu.com', {
timeout: 10000
})

const title = await page.title()
browser.close()
}

exports.handler = handler

  • I provided exact source code that allows reproducing the issue locally.

Link to the GitHub repository with the repro

[https://github.com/your_profile/playwright_issue_title]

or

Config file

Test file (self-contained)

Steps

  • [Run the test]
  • [...]

Expected

[Describe expected behavior]

Actual

[Describe actual behavior]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions