microsoft / vscode-spring-initializr

VSCode Extension for Spring Initializr
Other
70 stars 34 forks source link

Initializr Network Issues #101

Open belacyrf opened 5 years ago

belacyrf commented 5 years ago

As reported before here: https://github.com/Microsoft/vscode-spring-initializr/issues/84

I am having the same issue. I acknowledge this is not an extension bug, but I need to understand port / endpoints so I can request that the network paths are opened here at work.

First: VS Code is unable to fetch the avaliable Spring Versions as you can see here. It will sit and query forever without returning any versions. springinit_error

Second: IF I use start.spring.io to create my project there and then try to open using visual studio code. I am unable to compile my Spring Boot project due to not being able to import the dependencies.

I was able to take my PC to a different network and download the dependencies, so things work now, but I will not be the first with this issue. Can you please provide the network credentials to the Spring.io sources that the extension uses? We can then request our company network firewall allows it.

Looking for [network path / ip] -- [port] -- [protocol] (ex: start.spring.io, 443, tcp) ??

Thanks

Eskibear commented 5 years ago

To prevent hanging forever on version retrieving, I think maybe we can pop up an error message if timeout. So users are aware of what is happening.

To answer your questions: The extension follows the Spring Initializr official API guide. So the host is start.spring.io (if you don't specify a custom one), and the port should be 443, protocol is https (and yes it's on top of tcp). The request is sent via NodeJS API https.get.

belacyrf commented 5 years ago

Thank you for this, can you provide any tips as to why ONLY visual studio code has an issue with this??

When I run the http get per the documentation you supplied using postman, I get the values

"bootVersion": { "type": "single-select", "default": "2.1.2.RELEASE", "values": [ { "id": "2.2.0.BUILD-SNAPSHOT", "name": "2.2.0 (SNAPSHOT)" }, { "id": "2.1.3.BUILD-SNAPSHOT", "name": "2.1.3 (SNAPSHOT)" }, { "id": "2.1.2.RELEASE", "name": "2.1.2" }, { "id": "2.0.9.BUILD-SNAPSHOT", "name": "2.0.9 (SNAPSHOT)" }, { "id": "2.0.8.RELEASE", "name": "2.0.8" }, { "id": "1.5.20.BUILD-SNAPSHOT", "name": "1.5.20 (SNAPSHOT)" }, { "id": "1.5.19.RELEASE", "name": "1.5.19" } ] },

So using postman on my network works fine, using VSCode Extension fails. Any thoughts? Any methods of logging what is going on?

Eskibear commented 5 years ago

Second: IF I use start.spring.io to create my project there and then try to open using visual studio code. I am unable to compile my Spring Boot project due to not being able to import the dependencies.

I assume you are behind a corporate proxy (correct me if not). Based on the facts that you:

VSCode has setting entries to set proxy, but that won't affect the extensions, mentioned in the official docs below:

Extensions don't benefit yet from the same proxy support that VS Code supports.

Actually the extension proxy support is always a hot topic in VSCode. See https://github.com/Microsoft/vscode/issues/12588
Now as mentioned in https://github.com/Microsoft/vscode/issues/64202 , I think you can try the http.proxySupport config newly provided by VSCode. See if it work out.

image

belacyrf commented 5 years ago

the thing is, my PC doesn't believe there is a proxy server. proxy

So my Postman should be using the same network paths as VSCode. We definitely have web filters in place, but that should affect all of my applications the same way.

Eskibear commented 5 years ago

@belacyrf

It will sit and query forever without returning any versions.

It has been identified as a bug that exceptions are not well-handled. Without the error message, it's hard to guess the root cause. The bug has been fixed along with other code changes, and in the next version (will be shipped in this week), you are able to see the error message. Let's see what happened then.

Eskibear commented 5 years ago

v0.4.4 has been released, and you are supposed to see the error message now. I'm interested in the root cause, can you share the error message?

belacyrf commented 5 years ago

sure.. give me a bit, I will update and re-test. Just FYI, some of the other issues I was seeing had to do with SSL Inspection (not proxy). I had to add certs to the cacerts java store in order to connect to some of the repositories I needed to connect to. Unfortunately this did not help the spring initilizr.

Changing the Spring Initializr from https://start.spring.io to use standard http, it works fine using http, but of course SSL would be preferred.

FYI.. I'll respond tomorrow.. working via VPN doesn't have the same SSL inspection as on net at the office.

belacyrf commented 5 years ago

@Eskibear here is the error message: Fail to create a project. Error: self signed certificate in certificate chain

This error is the same regardless of the vsCode proxy settings (SSL Strict true or false), (proxy support On or Override).

Also the certs have been added to the cacerts keystore for my java instance. As of now there is no work around other than to use http instead of https for the start.spring.io endpoint.

Thanks

Eskibear commented 5 years ago

It looks an SSL cert issue now as you assumed. NodeJs https module doesn't honor your cacert java store. Have you added the self-signed cert into your OS certificate store? (But I'm not 100% sure whether the OS cert store will be honored by the NodeJs.)

Back to the NodeJs, the NODE_EXTRA_CA_CERTS environment variable might help you out, you might give it a try. Launch VS Code with the env configured, see if it work.