Skip to content

[Bug]: Cannot run program "/tmp/playwright-java-9325996558200189516/node": error=2, No such file or directory #1630

@anobilisgorse

Description

@anobilisgorse

Version

1.45.0

Steps to reproduce

Context

This is how we use Playwright in our application:

try (Playwright playwright = Playwright.create();
    Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setHeadless(true));
    Page page = browser.newContext().newPage()) {
   // do something with page
} catch (Exception e) {
   // throw e
}

However the JAR of our application became too large for our CI/CD pipeline due to Playwright - we noticed this is due to the drivers which includes for all supported OS, thus we did a Gradle workaround to only include the drivers we need (we used this as reference).

  • In our build.gradle, we repackaged driver-bundle.jar via Gradle's distribution plugin
  • From 163 MB, we were able to size down the driver-bundle.jar to 63 MB by only retaining the Linux drivers.

Expected behavior

When our application is run locally like via IDE, we are able to use Playwright without any issues.

Actual behavior

However if we run our app in Docker and invoked the API that uses Playwright, we encountered this error:
image

We then applied permissions to the /tmp/ folder via the Dockerfile

RUN chmod g+s /tmp/
RUN chown -R 1000:1000 /tmp/

but still we receive the same error. That's when we noticed that the playwright-java-*** folder below is actually only created during the first instance Playwright.create() is invoked, as it only initializes the driver by then.
image

We tried manually invoking the said node program inside the Docker instance and we received the same error as the logs.

What is the problem here? Is it because of our container using Alpine?

Additional context

No response

Environment

  • Operating System: [Alpine Linux via Docker]
  • Browser: [Chromium]
  • Java Version: [17]
  • Gradle Version: [8.1.1]

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