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]: Cannot run program "/tmp/playwright-java-9325996558200189516/node": error=2, No such file or directory #1630

Closed
anobilisgorse opened this issue Jul 19, 2024 · 2 comments

Comments

@anobilisgorse
Copy link

anobilisgorse commented Jul 19, 2024

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]
@yury-s
Copy link
Member

yury-s commented Jul 22, 2024

What is the problem here?

Hard to tell, you run some custom packages. The standard package seems to run fine in docker. If you want to skip the driver extraction step, you can pass 'playwright.cli.dir' property pointing to already installed driver's location which is probably your best bet. There is an open request for splitting the driver which is tracked in #1196, you can upvote that issue.

If you think this is an issue with standard Playwright packages, please file a new issue with a self-contained repro.

Is it because of our container using Alpine?

Alpine is not supported officially: https://playwright.dev/java/docs/intro#system-requirements

@yury-s yury-s closed this as completed Jul 22, 2024
@anobilisgorse
Copy link
Author

anobilisgorse commented Jul 23, 2024

The standard package seems to run fine in docker. If you want to skip the driver extraction step, you can pass 'playwright.cli.dir' property pointing to already installed driver's location which is probably your best bet.

@yury-s How do we pre install a driver? I can't seem to locate the instructions for this, kindly please point me to any guide. Thank you.

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

2 participants