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

[Question] Docker Target directory is expected to be absolute / extract-zip@2.0 does not support relative path #4867

Closed
florianbepunkt opened this issue Jan 2, 2021 · 2 comments
Assignees

Comments

@florianbepunkt
Copy link

I have a docker-compose env and added playwright to it. When I try to install it via docker (as part of a CI setup), the installation fails

UnhandledPromiseRejectionWarning: Error: Target directory is expected to be absolute
    at module.exports (/src/wp-content/plugins/cm-herakles-plugin/public/client/node_modules/extract-zip/index.js:167:11)
    at Object.downloadBrowserWithProgressBar (/src/wp-content/plugins/cm-herakles-plugin/public/client/node_modules/playwright/lib/install/browserFetcher.js:172:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async validateCache (/src/wp-content/plugins/cm-herakles-plugin/public/client/node_modules/playwright/lib/install/installer.js:103:9)
    at async installBrowsersWithProgressBar (/src/wp-content/plugins/cm-herakles-plugin/public/client/node_modules/playwright/lib/install/installer.js:60:5)

As far as I understand extract-zip does not support relative paths since version 2.0. I searched for this issue and apparently no-one else encountered this problem with playwright. But my setup is not very special or complicated, so in theory it should apply to other docker-compose setups as well (?)

Install command is
docker-compose run --rm --user 33:33 -e HOME=. playwright /bin/bash -c "cd src/wp-content/plugins/cm-herakles-plugin/public/client/ && npm ci && npm run test"

docker-compose

version: "3.3"

services:
  # other service left out for brevity
  playwright:
    container_name: playwright
    image: mcr.microsoft.com/playwright:bionic
    shm_size: "2gb"
    volumes:
      - "wp_data:/src:rw"
      - "config:/config:rw"
      - "./test:/test:rw"
volumes:
  config:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/config
      o: bind
  wp_data:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/src
      o: bind
@dgozman
Copy link
Contributor

dgozman commented Feb 10, 2021

The problem here is in HOME=. from. the command line. Playwright is installing browsers into the home directory, and we get the relative path - thus the error.

I'd overall advise against using relative HOME path because it will resolve to the different absolute path based on current working directory of any given program or (in our case) node script.

We'll see what we can do.

@dgozman
Copy link
Contributor

dgozman commented Feb 12, 2021

With #5406, this should probably work. However, we still advise to use absolute HOME env, e.g. HOME=$PWD to point to the current directory. Also, launching Firefox with relative HOME is not supported and will throw.

@dgozman dgozman closed this as completed Feb 12, 2021
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

5 participants