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]: Corepack eneable pnpm does not work in playwright image 1.43.X anymore #30400

Closed
MurmelStar opened this issue Apr 17, 2024 · 5 comments
Closed

Comments

@MurmelStar
Copy link

Version

1.43.1-focal

Steps to reproduce

gitlab-ci.yml job:

1.43.1 does not work anymore:
    stage: Quality Assurance
    image: $URL/playwright:v1.43.1-focal
    script: 
        - corepack enable pnpm
        - pnpm -v

Expected behavior

Output of the version of pnpm (and a working pnpm version)

Actual behavior

Gitlab console output:

$ corepack enable pnpm
$ pnpm -v
Internal Error: Error when performing the request to https://registry.npmjs.org/pnpm; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
    at fetch (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22882:11)
    at async fetchAsJson (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22896:20)
    at async fetchLatestStableVersion (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22948:20)
    at async fetchLatestStableVersion2 (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22971:14)
    at async Engine.getDefaultVersion (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:23349:25)
    at async executePackageManagerRequest (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:24207:28)
    at async BinaryCommand.validateAndExecute (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:211[73](https://git.dataport.de/pvog/tests/systemtest_frontend/-/jobs/3647020#L73):22)
    at async _Cli.run (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18)
    at async Object.runMain (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:12)
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: command terminated with exit code 1

Additional context

We installed pnpm with corepack enable pnpm how it is mentioned in the documentation of corepack and pnpm in the newest version:
https://pnpm.io/installation

The same example will work, if the image playwright:v1.42.1-focal will be used.

I used this 4 examples to verify, that it broke in the mentioned minor update. I do use a private Artifactory and some Proxys in my before script of the job. The error does exist since 1.43.0 and still in exist 1.43.1

1.42.1 Works:
    stage: Quality Assurance
    image: $ARTIFACTORY_URL/playwright:v1.42.1-focal
    script: 
        - node --version
        - corepack enable pnpm
        - pnpm -v

1.43.1 not working:
    stage: Quality Assurance
    image: $ARTIFACTORY_URL/playwright:v1.43.1-focal
    script: 
        - node --version
        - corepack enable pnpm
        - pnpm -v

1.43.1 pnpm installation fails because of existing not working installation:
    stage: Quality Assurance
    image: $ARTIFACTORY_URL/playwright:v1.43.1-focal
    script: 
        - node --version
        - corepack enable pnpm
        - npm install -g pnpm

1.43.1 overwrite pnpm installation and it works:
    stage: Quality Assurance
    image: $ARTIFACTORY_URL/playwright:v1.43.1-focal
    script: 
        - node --version
        - corepack enable pnpm
        - npm install -g pnpm --force
        - pnpm -v

Environment

$ node --version
v20.12.2
$ pnpm -v
9.0.1
$ npm -v
10.5.0
$ corepack -v
0.25.2
@yury-s
Copy link
Member

yury-s commented Apr 17, 2024

I cannot reproduce it on a fresh 1.43.1 image:

$ docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.43.1-focal /bin/bash
root@3a8f88d7da62:/# cd 
root@3a8f88d7da62:~# npm init playwright bug
...
root@3a8f88d7da62:~# cd bug/
root@3a8f88d7da62:~/bug# corepack enable pnpm
root@3a8f88d7da62:~/bug# pnpm -v
Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-9.0.2.tgz.

Do you want to continue? [Y/n] 
9.0.2

From the error message it looks like the command cannot connect to https://registry.npmjs.org/pnpm, probably a transient network issue?

@xsu1010
Copy link

xsu1010 commented Apr 18, 2024

Same error is now happening on my end after updating to the 1.43.1 docker image:

[2024-04-18T13:05:43.712Z] + corepack pnpm run set-npm-property 
[2024-04-18T13:05:43.964Z] Internal Error: Error when performing the request to https://registry.npmjs.org/pnpm; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
[2024-04-18T13:05:43.964Z]     at fetch (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22882:11)
[2024-04-18T13:05:43.964Z]     at async fetchAsJson (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22896:20)
[2024-04-18T13:05:43.964Z]     at async fetchLatestStableVersion (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22948:20)
[2024-04-18T13:05:43.964Z]     at async fetchLatestStableVersion2 (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22971:14)
[2024-04-18T13:05:43.964Z]     at async Engine.getDefaultVersion (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:23349:25)
[2024-04-18T13:05:43.964Z]     at async executePackageManagerRequest (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:24207:28)
[2024-04-18T13:05:43.964Z]     at async BinaryCommand.validateAndExecute (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:21173:22)
[2024-04-18T13:05:43.964Z]     at async _Cli.run (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18)
[2024-04-18T13:05:43.964Z]     at async Object.runMain (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:12)
script returned exit code 1

Version 1.42.0 also works fine with corepack, but my project's dependencies attempt to install Playwright 1.43.1, which then breaks when running tests:

[2024-04-18T13:43:54.353Z] ????????? browserType.launch: Executable doesn't exist at /ms-playwright/chromium-1112/chrome-linux/chrome
[2024-04-18T13:43:54.353Z] ????????? Looks like Playwright Test or Playwright was just updated to 1.43.1. ?????????
[2024-04-18T13:43:54.353Z] ????????? Please update docker image as well.                                  ?????????
[2024-04-18T13:43:54.353Z] ????????? -  current: mcr.microsoft.com/playwright:v1.42.0-focal               ?????????
[2024-04-18T13:43:54.353Z] ????????? - required: mcr.microsoft.com/playwright:v1.43.1-focal               ?????????
[2024-04-18T13:43:54.353Z] ?????????                                                                      ?????????
[2024-04-18T13:43:54.353Z] ????????? <3 Playwright Team                                                   ?????????

My current workaround is to enforce the installed dependencies by using pnpm.overrides in my project's package.json:

"pnpm": {
  "overrides": {
    "@playwright/test": "1.42.0",
    "playwright": "1.42.0"
  }
}

But ideally that shouldn't stay there for too long 😅

@yury-s
Copy link
Member

yury-s commented Apr 18, 2024

Not sure how we can help here, I tried again on a fresh setup without creating npm package and works fine, it also works fine on our CI, so it does seem to be a problem with your machines access to https://registry.npmjs.org/pnpm.

@MurmelStar
Copy link
Author

The Problem is the update of the corepack dependency to 0.25 or greater. If you would downgrade the corepack version when using the playwright image 1.43.x with npm install --global corepack@0.24.0 it will work again.

Corepack changed the way its connect to a private Artifactory. There are some env variables to connect to your private Artifactory but I couldn't get it to work. I get a 401 for not Authorized even when I use the same credentials I use in other jobs:

         COREPACK_NPM_REGISTRY: $ARTIFACTORY_URL
         COREPACK_NPM_USERNAME: $ARTIFACTORY_HA_USER_READ
         COREPACK_NPM_PASSWORD: $ARTIFACTORY_HA_PASSWORD_READ

or COREPACK_NPM_TOKEN. I couldn't get anything to work and I guess it is a question to corepack itself and not here. I will open a Ticket or link an existing Ticket when I find one.

Another workaround which I use is to install pnpm with npm npm install -g pnpm. That works but has some problems with the versioning.

@yury-s
Copy link
Member

yury-s commented Apr 19, 2024

Closing per the description above. There is already a related issue in corepack: nodejs/corepack#458

@yury-s yury-s closed this as completed Apr 19, 2024
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

3 participants