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] Safari/WebKit browser doesn't work in docker container (libsoup3 upgrade required) #23259

Closed
1 task
sylhero opened this issue May 24, 2023 · 15 comments · Fixed by #26596
Closed
1 task

Comments

@sylhero
Copy link

sylhero commented May 24, 2023

System info

  • Playwright Version: [v1.34.2]
  • Operating System: [macOS 13.2, mcr.microsoft.com/playwright:v1.34.2-jammy]
  • Browser: [WebKit]
  • Other info:

Source code

Link to the GitHub repository with the repro

[https://github.com/sylhero/playwright-bug]

Steps

Expected

it should work as running on the local

Actual

blank screen and timeout

@unickq
Copy link

unickq commented May 24, 2023

+1. Previously it used to work without any extra packages. Probably need to rebuild the docker image with libgudev

    Error: browserType.launch: 
    ╔══════════════════════════════════════════════════════╗
    ║ Host system is missing dependencies to run browsers. ║
    ║ Please install them with the following command:      ║
    ║                                                      ║
    ║     npx playwright install-deps                      ║
    ║                                                      ║
    ║ Alternatively, use apt:                              ║
    ║     apt-get install libgudev-1.0-0                   ║
    ║                                                      ║
    ║ <3 Playwright Team                                   ║
    ╚══════════════════════════════════════════════════════╝

@aslushnikov
Copy link
Collaborator

@sylhero @unickq I've tried the following and worked for me:

$ docker run --rm -it mcr.microsoft.com/playwright:v1.34.2 /bin/bash
root@96e6aeada06b:/$ cd && npm init -y && npm i @playwright/test@1.34.2
root@96e6aeada06b:~$ cat <<'EOF' > a.mjs
import { webkit } from '@playwright/test';
const browser = await webkit.launch();
const page = await browser.newPage();
console.log(await page.evaluate(() => navigator.userAgent));
await browser.close();
EOF
root@96e6aeada06b:~$ node a.mjs
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15

We had the issue with the missing dependency, but it should be fixed with 1.34.2 docker image.

@sylhero
Copy link
Author

sylhero commented May 24, 2023

@unickq @aslushnikov Thanks for looking into this issue! Yes, it works with other testcases and I have no problem with the docker image or test execution. The real problem for me is if I run the test on my local mac machine directly it works but when I execute the same test with the image it fails. I would like to understand why it happens or did I just find an edge case that breaks the test execution within the container?

@aslushnikov
Copy link
Collaborator

aslushnikov commented May 24, 2023

@sylhero The issue you're talking about does exit in Playwright 1.34.0 and the corresponding 1.34.0 container: #23186

However, it was fixed in the patch releases. So please make sure you use 1.34.2 docker container and latest & greatest Playwright as well.

@sylhero
Copy link
Author

sylhero commented May 24, 2023

@aslushnikov I created the test repo with exactly the version you mentioned https://github.com/sylhero/playwright-bug/blob/main/Dockerfile#L1 and https://github.com/sylhero/playwright-bug/blob/main/sample/package.json#L11 and it's still not working

@aslushnikov
Copy link
Collaborator

@sylhero your test does fail for me on webkit. The reason it doesn't work is that the website fails to render due to some bad character:

image

@sylhero
Copy link
Author

sylhero commented May 24, 2023

@aslushnikov so two things:

  1. the website renders properly in all browsers. You can open the link in the test case directly on your local machine
  2. I enabled chrome,firefox and edge and run the test in the container they all work
Screenshot 2023-05-24 at 7 12 05 PM Screenshot 2023-05-24 at 7 12 11 PM

Besides that, if I just run the test directly on the local machine it all worked

Screenshot 2023-05-24 at 7 26 41 PM Screenshot 2023-05-24 at 7 26 47 PM

so without container, all browsers/tests passed. With container only Safari failed.

@mxschmitt
Copy link
Member

I was able to reproduce and found out that this is a libsoup2 bug. Once we migrate to libsoup3 this is gonna be fixed. Assigning to me by that.

@mxschmitt mxschmitt self-assigned this May 31, 2023
@mxschmitt mxschmitt changed the title [BUG] Safari/WebKit browser doesn't work in docker container [BUG] Safari/WebKit browser doesn't work in docker container (libsoup3 upgrade required) Jun 2, 2023
@aslushnikov aslushnikov added v1.36 and removed v1.35 labels Jun 5, 2023
@Tom-Hudson
Copy link

@mxschmitt - so what is the workaround for now? Manually installing libsoup3 in the container?

Is this going to be a fix to the mcr.microsoft.com/playwright:X image?

@mxschmitt
Copy link
Member

There is unfortunately no workaround available as of today. We need to finish the libsoup3 migration on our side, which we hope to be able to complete with 1.36. But generally speaking we can't commit to any date.

Thanks for your understanding.

@aslushnikov aslushnikov added v1.37 and removed v1.36 labels Jul 7, 2023
@mxschmitt mxschmitt assigned yury-s and unassigned mxschmitt Jul 17, 2023
@aslushnikov
Copy link
Collaborator

Merging this into the libsoup3 tracking bug: #22569

@sylhero
Copy link
Author

sylhero commented Aug 16, 2023

The issue persists in v1.37

@gomdolkim
Copy link

gomdolkim commented Aug 17, 2023

@aslushnikov what version of playwright we can use? #22569 is still open and as someone mentioned above, v1.37 still has same issue.

@mxschmitt
Copy link
Member

mxschmitt commented Aug 17, 2023

This issue is still open and isn't fixed yet.

It's merged into #22569

@mxschmitt
Copy link
Member

mxschmitt commented Aug 21, 2023

@sylhero I was looking into your issue. The issue is that the https://upg.plusgrade.com/static/app/app.727ce299.js site returns the response as a "double encoded gzip". This means its a gzip in a gzip which is not per spec. The Content-Type header is wrong, it should be application/javascript.

It works in Chromium and WebKit (with libsoup3) because both accept Brotli as an encoding as well, so then the server will prefer Brotli and the server sends the response correctly when Brotli is accepted while our WebKit as of today (libsoup2.4) does not support Brotli.

You can observe it by doing:

curl -v -H "Accept-Encoding: deflate, gzip" https://upg.plusgrade.com/static/app/app.727ce299.js

compared to e.g.:

curl -v -H "Accept-Encoding: deflate, gzip" https://microsoft.github.io/monaco-editor/runtime.js

The libsoup3 migration is almost done, so it will start working after #26596.

mxschmitt added a commit that referenced this issue Aug 22, 2023
This should make it into v1.38 and once its merged one day later it can
be tested in [Playwright
Canary](https://playwright.dev/docs/canary-releases).

Fixes #22569
Fixes #23259
Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
This should make it into v1.38 and once its merged one day later it can
be tested in [Playwright
Canary](https://playwright.dev/docs/canary-releases).

Fixes microsoft#22569
Fixes microsoft#23259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants