yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.44k stars 1.11k forks source link

[Bug?]: Can't fetch Gitlab dependencies via SSH #6503

Closed sensiblepuffin closed 2 weeks ago

sensiblepuffin commented 1 month ago

Self-service

Describe the bug

Yarn (v2.4.3) is unable to fetch Gitlab repos via SSH because (I think) the namespaces cause URL parsing to fail.

After experimenting with different node versions (and not having much luck), I found the WHATWG standard (which Node has moved to) that clearly rejects a URL that resembles a Gitlab SSH URL:

image

The specific deprecation in question is here.

Example:

# $ node --version && node yarn install
v20.17.0
➤ YN0000: ┌ Resolution step
➤ YN0000: │ DeprecationWarning: The URL ssh://git@code.company.com:person/babel-plugin-make-defer-hydration-imports-eager.git is invalid. Future versions of Node.js will throw an error.
➤ YN0001: │ TypeError: babel-plugin-make-defer-hydration-imports-eager@git+ssh://git@code.company.com:person/babel-plugin-make-defer-hydration-imports-eager.git#hash: Invalid URL
    at new URL (node:internal/url:797:36)
    at Module.d (/var/www/project/yarn.js:2:420910)
    at b (/var/www/project/yarn.js:2:144699)
    at v (/var/www/project/yarn.js:2:145213)
    at F.resolvers.getCandidates (/var/www/project/yarn.js:2:148889)
    at n.getCandidates (/var/www/project/yarn.js:2:344526)
    at n.getCandidates (/var/www/project/yarn.js:2:344526)
    at /var/www/project/yarn.js:2:366182
    at Module.w (/var/www/project/yarn.js:2:425653)
    at C (/var/www/project/yarn.js:2:366145)
➤ YN0000: └ Completed in 0s 399ms
➤ YN0000: Failed with errors in 0s 404ms

After the offending colons are replaced with slashes, it obviously can't fetch the packages but yarn doesn't complain.

# $ node --version && node yarn install | grep git@
v20.17.0
➤ YN0013: │ chartiq@git+ssh://git@code.company.com/its/chartiq.git#commit=hash can't be found in the cache and will be fetched from the remote repository
➤ YN0013: │ babel-plugin-make-defer-hydration-imports-eager@git+ssh://git@code.company.com/person/babel-plugin-make-defer-hydration-imports-eager.git#commit=hash can't be found in the cache and will be fetched from the remote repository

To reproduce

Environment

System:
    OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (4) x64 Intel(R) Xeon(R) Gold 6252 CPU @ 2.10GHz
  Binaries:
    Node: 19.2.0 - /tmp/xfs-c9fb61a5/node
    Yarn: 2.4.3 - /tmp/xfs-c9fb61a5/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v19.2.0/bin/npm

Additional context

No response

clemyan commented 1 month ago

I can reproduce on 2.4.3 but not on 4.5.0. Probably fixed in #5100. Please upgrade your Yarn version.

yarnbot commented 3 weeks ago

Hi! 👋

It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it.