question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Not able to install Playwright in Docker on M1 with aarch64 architecture

See original GitHub issue

Playwright version

1.12.1

Operating system

MacOS

What browsers are you seeing the problem on?

Chromium

Other information

No response

What happened? / Describe the bug

Hi

I’m using playwright docker image here => https://hub.docker.com/_/microsoft-playwright

I encounter an issue where if I run playwright in the docker, I would have the below error

(node:97) UnhandledPromiseRejectionWarning: Error: Page closed at CRSession.<anonymous> (/usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crPage.js:341:60) at Object.onceWrapper (events.js:420:28) at CRSession.emit (events.js:326:22) at /usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crConnection.js:177:43 (node:97) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

It run fine in my own machine (macOS m1). I research and saw that it is related to browser.close too early. However, I’m using pytest and is using playwright as sync and not async function since pytest has fixture which can yield the page and then do a browser close later. E.g code below:

@pytest.fixture def page(): with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() yield page browser.close()

Do we. know why the same code run fine in my local machine but not in playwright docker?

Code snippet to reproduce your bug

No response

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kumaraditya303commented, Jul 8, 2021

@budsee As per the logs, on apple m1 the docker runs natively with arm64 but currently playwright only supports x86_64 on linux docker, if you want to run it currently then you need to emulate x86 with qemu.

0reactions
mxschmittcommented, Jul 29, 2021

Since the Python image is based on the upstream one, I will close this one here and we will track it upstream: https://github.com/microsoft/playwright/issues/7723

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker image based on Playwright image runs on my Mac but ...
This image cannot be executed on another architecture (probably amd64 for your Ubuntu server). You should: use an amd64 base image ( mcr....
Read more >
Playwright for Java by Microsoft - Docker Hub
If the Playwright version in your Docker image does not match the version in your project/tests, Playwright will be unable to locate browser...
Read more >
Exit 254 lambda error with no extra explanations | AWS re:Post
I have a Lambda function running a docker container. The docker container runs without issue localy but on AWS lambda all I get...
Read more >
Scraping without JavaScript using Chromium on AWS Lambda
It appears that Docker as configured within the runners provided by GitHub Actions do not native support building ARM images. However, you can ......
Read more >
Building Multi-CPU Architecture Docker Images for ARM and ...
In “Building Multi-CPU Architecture Docker Images for ARM and x86 (1): The Basics”, we covered the general workflow of building multi-arch Docker images ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found