Search code examples
playwrightjava-17playwright-java

Unable to run Playwright project on Ubuntu 20.04 server


I'm able to run my project on my pc, and another place.

But when I try to deploy it production it just breaks.

I get following issues:

java.lang.RuntimeException: Failed to create driver
        at com.microsoft.playwright.impl.driver.Driver.createAndInstall(Driver.java:105)
        at com.microsoft.playwright.impl.driver.Driver.ensureDriverInstalled(Driver.java:57)
        at com.microsoft.playwright.impl.PlaywrightImpl.createImpl(PlaywrightImpl.java:45)
        at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:35)
        at com.microsoft.playwright.Playwright.create(Playwright.java:110)
        at com.microsoft.playwright.Playwright.create(Playwright.java:114)
        at getAuthor(PlaywrightAuthorService.java:27)
        at .lambda$getAuthorById$0(AuthorServiceImpl.java:27)
        at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:152)
        at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
        at reactor.core.publisher.Mono.subscribe(Mono.java:4440)
        at reactor.core.publisher.Mono.subscribeWith(Mono.java:4570)
        at reactor.core.publisher.Mono.subscribe(Mono.java:4422)
        at reactor.core.publisher.Mono.subscribe(Mono.java:4358)
        at com.salesforce.reactorgrpc.stub.ServerCalls.oneToOne(ServerCalls.java:41)

Caused by: java.lang.RuntimeException: Failed to install browsers, exit code: 134
        at com.microsoft.playwright.impl.driver.jar.DriverJar.installBrowsers(DriverJar.java:100)
        at com.microsoft.playwright.impl.driver.jar.DriverJar.initialize(DriverJar.java:69)
        at com.microsoft.playwright.impl.driver.Driver.initialize(Driver.java:64)
        at com.microsoft.playwright.impl.driver.Driver.createAndInstall(Driver.java:101)
        ... 31 common frames omitted

I use JDK17

I thought it might be something with my NGINX config that I have

server {
    listen 443 ssl http2;
    server_name my-url.website.com

    ssl_certificate /root/.acme.sh/key.cer;
    ssl_certificate_key /root/.acme.sh/key.key;
    ssl_session_cache shared:SSL:10m;

    client_header_timeout 7d;
    client_body_timeout 7d;
    grpc_read_timeout 7d;
    grpc_send_timeout 7d;
    grpc_connect_timeout 7d;


    location / {
       grpc_pass grpc://localhost:9090;
    }

    default_type application/grpc;
}

But I think it is not related.

I tried using npx init with node, and that also did not help.


Solution

  • Based on the issue I solved by switching to docker I was unable to see why it did not work without it.