Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Connect error: caused by unable to verify the first certificate #564

Open
unional opened this issue May 31, 2016 · 5 comments
Open

Connect error: caused by unable to verify the first certificate #564

unional opened this issue May 31, 2016 · 5 comments

Comments

@unional
Copy link
Member

unional commented May 31, 2016

By @morwin10:

I get errors when i type: typings install dt~es6-shim --global --save

typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/es6-shim/versions/latest"
typings ERR! caused by unable to verify the first certificate

typings ERR! cwd C:\Users\morwin\Documents\angular2-cademy
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\morwin\\AppData\\Roaming\\npm\\node_modules\\typings\\dist\\bin.js" "install" "dt~es6-shim" "--global" "--save"
typings ERR! node -v v6.2.0
typings ERR! typings -v 1.0.4
typings ERR! code EUNAVAILABLE

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>
@bensontrent
Copy link
Contributor

bensontrent commented May 31, 2016

A caveat: This solution is less secure, bad practice, don't do this.
I had a duplicate error message--I'm behind a corporate VPN/firewall. I was able to resolve this issue by adding a .typingsrc file to my user directory (C:\Users\MyUserName\.typingsrc in windows). Of course, anytime you're circumventing SSL you should be yapping to your sys admins to fix the certificate issue.

Change the registry url protocol from https to http, and as seen elsewhere in this forum, set rejectUnauthorized to false.

.typingsrc (placed in project directory or in user root directory)

{
     "rejectUnauthorized": false,
     "registryURL": "http://api.typings.org/"
}

Optionally add your github token (I didn't find success until I had added this too.)

{
    "rejectUnauthorized": false,
    "registryURL": "http://api.typings.org/",
    "githubToken": "YourGitHubToken"
}

See instructions for setting up your token at https://github.com/blog/1509-personal-api-tokens

@morwin10
Copy link

morwin10 commented May 31, 2016

it works !!
Thank you very much !
I did it like this as you said :

{
     "rejectunauthorized": false,
     "registryurl": "http://api.typings.org/"
}

in my user root directory ( C:\Users\morwin\)

@baltie
Copy link

baltie commented Jun 16, 2016

I'm behind a corporate proxy that messes up the certificate chain. In typings@0.7.12, I was able to use typings by setting rejectUnauthorized=false in .typingsrc, and the proxy server address is defined in environment variables HTTP_PROXY and HTTPS_PROXY.

However, in 1.2.0, this didn't work anymore and I get:
typings ERR! message https://api.typings.org/search?query=d3 responded with 403, expected it to equal 200 when I do typings search d3 for instance.

I can copy that URL into Chrome and I get the search result there as JSON. If I look at the certificate chain there, I see that the corporate proxy has injected itself as CA. That CA certificate is in the trusted certificate store.

If I remove rejectUnauthorized=false in .typingsrc, I get this error:

typings ERR! message Unable to connect to "https://api.typings.org/search?query=d3"
typings ERR! caused by unable to verify the first certificate

As I said, in typings v0.7.12 setting rejectUnauthorized to false worked. In 1.2.0 it doesn't. I haven't used it in the intermediate versions.

The only workaround I've found that works behind a corporate proxy now is adding registryURL=http://api.typings.org/ to .typingsrc so that the rc file looks like what is mentioned in previous comments. I still need rejectUnauthorized=false as that is passed to the service downloading the actual typings. This is the rc file that works:

rejectUnauthorized=false
registryURL=http://api.typings.org/

To me, it seems that something at the api.typings.org end is rejecting my request with a 403 when typings try to access api.typings.org, which is weird as it works through Chrome.

@magwalls
Copy link

I'm also behind a corporate proxy and were getting this error message

typings ERR! message Unable to connect to       "https://api.typings.org/entries/dt/jasmine/tags/2.2.0%2B20160505161446"
typings ERR! caused by write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:

By using the suggestion above and adding this to a .typingsrc file I get another error message however.

rejectUnauthorized=false,
registryURL=http://api.typings.org/

The error message I get now is this:

$ typings install
typings WARN deprecated 2016-06-13: "registry:dt/node#4.0.0+20160509154515" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-02: "registry:dt/core-js#0.0.0+20160317120654" is deprecated (updated, replaced or removed)
typings ERR! message Unable to read typings for "core-js". You should check the entry paths in "core-js.d.ts" are up to date
typings ERR! caused by Unable to connect to "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/core-js/core-js.d.ts"
typings ERR! caused by write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:

I'm trying to get the quickstart of Angular 2 working behind a corporate proxy and my typings.json looks like this if it might be of any help.

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160317120654",
    "jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
    "node": "registry:dt/node#4.0.0+20160509154515"
  }
}

@bensontrent
Copy link
Contributor

#615 Added information on .typingsrc files to faq and added upgrade instruction for .tsdrc to .typings.rc

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

6 participants