[Bug?]: Can't fetch Gitlab dependencies via SSH
Self-service
- [X] I'd be willing to implement a fix
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:
The specific deprecation in question is here.
Example:
# $ node --version && node yarn install
v20.17.0
➤ YN0000: ┌ Resolution step
➤ YN0000: │ DeprecationWarning: The URL ssh://[email protected]: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://[email protected]: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://[email protected]/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://[email protected]/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
- Create a new yarn project with
yarn init - Add any dependency that points to a Gitlab repo via SSH (no need for a specific commit hash)
- Run
yarn install - You should see the
TypeError: Invalid URLerror as above.
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
I can reproduce on 2.4.3 but not on 4.5.0. Probably fixed in #5100. Please upgrade your Yarn version.
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.