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

Connecting to generic v2 registry is failing #4245

Closed
Tracked by #4394 ...
pWoLiAn opened this issue Feb 21, 2024 · 23 comments
Closed
Tracked by #4394 ...

Connecting to generic v2 registry is failing #4245

pWoLiAn opened this issue Feb 21, 2024 · 23 comments
Milestone

Comments

@pWoLiAn
Copy link

pWoLiAn commented Feb 21, 2024

using latest extension version.
When connecting to registry, get the message "fetch failed"
image
im able to pull using CLI
image
EDIT:
the extension works properly with the previous version(1.28). issue is seen only with the latest version(1.29)

vscode details:
Version: 1.86.2 (user setup)
Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
Date: 2024-02-13T19:40:56.878Z
Electron: 27.2.3
ElectronBuildId: 26908389
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.22631

running on ubuntu 20.4 with remote SSH

@bwateratmsft
Copy link
Collaborator

Try removing the /v2 from your registry URL, the extension adds that automatically as needed.

@pWoLiAn
Copy link
Author

pWoLiAn commented Feb 21, 2024

still failing with the same error

@bwateratmsft
Copy link
Collaborator

Can you tell me more about your registry provider? It may not be supported by the generic V2 registry connection.

@pWoLiAn
Copy link
Author

pWoLiAn commented Feb 22, 2024

What type of information do you need? Although i dont think this is an issue with the registry because I'm able to connect to it normally with version 1.28.

@bwateratmsft
Copy link
Collaborator

That's helpful to know. I think the most likely change that could have caused this is microsoft/vscode-docker-extensibility@24e2d35, we changed from using node-fetch to the built-in fetch in Node.js 18. Are you using a proxy?

@pWoLiAn
Copy link
Author

pWoLiAn commented Feb 22, 2024

yes i am

@bwateratmsft
Copy link
Collaborator

Are you able to test without the proxy in place? It would be helpful to know for sure if the issue is something to do with the proxy.

@pWoLiAn
Copy link
Author

pWoLiAn commented Feb 22, 2024

i cannot access the registry without the proxy but i can try using a different proxy

@westy
Copy link

westy commented Feb 23, 2024

I'm getting the same issue. It was working with a previous version of the extension, and now it's not.
I suspect it might be something to do with the cert on the private registry (hosted on a local linux server) being self-signed?

The certificate is installed as a trusted CA on the machine, and I can browse to it fine in a web browser.

Is there any logging for the extension that I can look at perhaps?

Cheers

@bwateratmsft
Copy link
Collaborator

That's very helpful to know. @pWoLiAn does your registry also use a self-signed certificate?

@pWoLiAn
Copy link
Author

pWoLiAn commented Feb 27, 2024

yes

@fengjianxincoke
Copy link

I had the same problem with my mac,
vs code version: 1.88.1
docker plugin version: 1.29.0
I can't connect to docker hub registried
Uploading WechatIMG149.jpg…

@TorchDSP
Copy link

TorchDSP commented May 5, 2024

Our current workaround is to use version v1.28.0. Otherwise getting the fetch failed message. Tried v1.29.1 this morning. Same issue as found with v1.29.0.

What we have seen is that with the newer versions it doesn't seem to reach out to the remote server. We don't see any new logs in the registry container. With v1.28.0 we see the GET transaction.

After more diagnosis, the fetch actually isn't being done on a consistent basis. No packets across the network and the plugin just declares the fetch failed. We are not using self-signed certificates.

@tonimore
Copy link

I confirm that 1.28.0 working fine and 1.29.1 doesn't

@RuthAlk
Copy link

RuthAlk commented Jul 17, 2024

another confirmation. Glad to have found this work-around, downgrading to 1.28 works.

@danegsta
Copy link
Contributor

1.29.2 that was just pushed to the marketplace yesterday contains fixes to the Accept header used by the extension when connecting to V2 registries. I can't guarantee it will solve all the connection issues being reported, but it's worth testing to see if you're unblocked with the latest release.

@westy
Copy link

westy commented Aug 15, 2024

1.29.2 that was just pushed to the marketplace yesterday contains fixes to the Accept header used by the extension when connecting to V2 registries. I can't guarantee it will solve all the connection issues being reported, but it's worth testing to see if you're unblocked with the latest release.

Hi,

Good to hear updates are being made. Unfortunately this does not solve the self-certificate issue for it, so have had to revert to 1.28.0
Hopefully a future update can sort it.

Cheers

@RuthAlk
Copy link

RuthAlk commented Aug 16, 2024

1.29.2 that was just pushed to the marketplace yesterday contains fixes to the Accept header used by the extension when connecting to V2 registries. I can't guarantee it will solve all the connection issues being reported, but it's worth testing to see if you're unblocked with the latest release.

Thanks for the update, but as mentioned above as well, it does not fix the issue with connecting to a docker with self-signed certificate. Reverted to 1.28

@bwateratmsft
Copy link
Collaborator

bwateratmsft commented Aug 21, 2024

So, it's not a good security practice, but you might be able to work around it by setting the environment variable NODE_TLS_REJECT_UNAUTHORIZED=0 for VSCode before launching it. Node.js has a static list of trusted root certificates; the system certificate store is ignored unfortunately.

A better solution would be to get "real" certificates for the registries, but of course that likely will cost money.

EDIT: see @danegsta's comment just below for a better possible workaround.

@danegsta
Copy link
Contributor

It looks like node also supports trusting a specific certificate by setting the NODE_EXTRA_CA_CERTS environment variable (i.e. NODE_EXTRA_CA_CERTS=/path/to/your/cert.pem). This should hopefully allow you to trust the specific certificate without disabling the certificate trust feature entirely.

@pWoLiAn
Copy link
Author

pWoLiAn commented Sep 25, 2024

@danegsta @bwateratmsft Can i set this ENV variable(NODE_EXTRA_CA_CERTS) as part of ~/.bashrc? Will the extension be able to pick it up from there?
UPDATE: I'm able to bypass the issue by setting the env in my bashrc(im using ubuntu). Closing since I feel like the issue has served its purpose.

@bwateratmsft
Copy link
Collaborator

I'm not familiar enough with Unix to know for sure, you'd have to try it out.

@pWoLiAn pWoLiAn closed this as completed Sep 27, 2024
@samran5 samran5 mentioned this issue Oct 8, 2024
@egoward
Copy link

egoward commented Nov 2, 2024

I hit this with my private registry and found a setting in VSCode -

HTTP / Experimental / System Certificates V2
"Controls whether experimental loading of CA certificates from the OS should be enabled..."

I think that basically fixes the odd default behaviour where it trusts a bundle of certs that ship with NodeJS

Also, it would be nice if the real TLS errors appeared somewhere.

@microsoft microsoft locked and limited conversation to collaborators Nov 12, 2024
@bwateratmsft bwateratmsft modified the milestones: 1.30.0, 1.29.4 Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants