Angular-cli: ng update ignores strict-ssl configuration

Created on 2 May 2018  路  7Comments  路  Source: angular/angular-cli

When using a .npmrc file which contains

registry=myCustomRegistry
strict-ssl=false

for self signed certificates, ng update @angular/cli ignores the strict-ssl config and prints out
unable to verify the first certificate and aborts.

Angular CLI: 6.0.0-rc.9
Node: 10.0.0
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.12
@angular-devkit/build-angular     0.5.12
@angular-devkit/build-optimizer   0.5.12
@angular-devkit/core              0.5.12
@angular-devkit/schematics        0.5.12
@angular/cli                      6.0.0-rc.9
@ngtools/webpack                  1.10.2
@schematics/angular               0.5.12
@schematics/update                0.5.12
rxjs                              5.5.10
typescript                        2.6.2
webpack                           4.6.0

Most helpful comment

Which version will this be included in?

All 7 comments

Would be useful to respect cafile property as well.

Thanks a lot :)

Which version will this be included in?

Hello? 6.1.1 and this is still an issue. There are no alternative ways of getting this to work at the moment, which means that we're going to have to drop angular soon.

It seems that there is a regression with 6.1.X. npm update worked for me in 6.0.8, but with 6.1.1 not any longer.

I tracked the issue down to schematics/update/update/npm.ts#L125-L139.

Looks like strictSsl is actually a boolean and not a string so the if statements below won't do anything. I changed the code to this in the compiled output and it works now:

function getNpmClientSslOptions(strictSsl, cafile) {
    const sslOptions = {};
    sslOptions.strict = strictSsl;
    if (cafile) {
        sslOptions.ca = fs_1.readFileSync(cafile);
    }
    return sslOptions;
}

In addition, I also had to manually pass my registry even though I have it set in my environment as npm_config_registry, so I did the following after the fix above to update:

ng update --all --registry=$npm_config_registry

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings