now-cli login error "unable to get local issuer certificate"

Islam Messaadi
Tera Expert

Hello Guys,

I have tried to login to my PDI, using NOW-CLI tool! but unfortunatly i obstructed by this showen error:

unable to get local issuer certificate

λ now-cli login --host https://xxx-xxx.service-now.com --password xxxxxx
× Connection to 'https://xxx-xxx.service-now.com' failed. Credentials not saved.
unable to get local issuer certificate

 login [host] [method] [username] [password]

Options:
  --help      Show help                                                [boolean]
  --version   Show version number                                      [boolean]
  --host      glide instance url    [string] [default: "https://localhost:8443"]
  --method    authentication method        [choices: "basic"] [default: "basic"]
  --username  basic auth username                    [string] [default: "admin"]
  --password  basic auth password                    [string] [default: "admin"]

find_real_file.png

My development environment detail:

λ node -v
v14.17.2

λ npm -v
6.14.13

λ now-cli --version
Now CLI @19.0.0

λ npm list -g --depth 0
C:\Program Files\nodejs
+-- @servicenow/cli@19.0.0
+-- keytar@7.7.0
`-- npm@6.14.13

npm ERR! peer dep missing: @octokit/core@>=3, required by @octokit/plugin-request-log@1.0.4

---------------------------------------------

1- Global installation folder(C:\Program Files\nodejs) --> accessible for admins/trusted users.

2- I ran the command as an administrator.

 

Any suggestion or ideas would be much appreciated thank you all 🙂

Best regards,

1 ACCEPTED SOLUTION

Hello,

Finally, the solution was to set reject unauthorized TLS to no (windows - CMD command):

 

set NODE_TLS_REJECT_UNAUTHORIZED=0

Hope this will help people who had faced the same issue as me!

Best regards 🙂

View solution in original post

8 REPLIES 8

Islam Messaadi
Tera Expert

Hi,

As a workaround solution is to create the project offline (Windows 10 environment):

NPM:

  1. set NODE_TLS_REJECT_UNAUTHORIZED=0
  2. npm config set strict-ssl false
  3. VC_redist.x64.exe
  4. python-2.7.amd64
  5. npm config set python C:\Python27 (python27 path)
  6. npm install --global --production windows-build-tools

NowUI Framework:

  1. snc extension add --name ui-component
  2. snc configure profile set
  3. snc ui-component project --name {comp-name} --description {description} --profile {profile} --offline --scope {scope}
  4. npm i
  5. npm audit fix
  6. snc ui-component develop
  7. snc ui-component deploy

Issue still same when i try to deploy the component or login to my instance using now-cli tool:

Login:

now-cli login --host https://xxx.service-now.com --method basic --username xxxx --password xxxxx
× Connection to 'https://xxx.service-now.com' failed. Credentials not saved.
unable to get local issuer certificate

or

snc ui-component login https://xxx.service-now.com basic xxxx xxxxx
× Connection to 'https://xxx.service-now.com' failed. Credentials not saved.
unable to get local issuer certificate

 

Regards,

Islam

 

Hello,

Finally, the solution was to set reject unauthorized TLS to no (windows - CMD command):

 

set NODE_TLS_REJECT_UNAUTHORIZED=0

Hope this will help people who had faced the same issue as me!

Best regards 🙂

Michele22
Tera Contributor

Hy guys I have the same issue.

This is my environment:

node -v
v16.13.1

npm -v 8.1.2

snc version
{ "extensions":
  {
     "ui-component": "21.0.7"
  },
  "snc": "1.1.0"
}

content of file C:\Users\my-user\.npmrc

strict-ssl=false
cafile=C:\Users\my-user\Documents\sviluppo\snow.crt


I tried to exec the command (but without success)

set NODE_TLS_REJECT_UNAUTHORIZED=0

I tried to exec the command (but without success)

npm config set strict-ssl false

I tried to download the servicenow certificate and convert it to PEM and add it to .npmrc file and to Windows system environment variables (but without success)

 

Is there something else that I can try?

Could it be a problem of windows setting? some restriction? How can I check it?

Any help or suggestion are appreciated

 
PS
I try to connect to a free development instance of servicenow from a Windows 10 PC, using powershell terminal

HI Michele,

Did you run this command as an administrator?

set NODE_TLS_REJECT_UNAUTHORIZED=0

Please try to follow thses steps:

NPM:

  1. set NODE_TLS_REJECT_UNAUTHORIZED=0
  2. npm config set strict-ssl false
  3. VC_redist.x64.exe --> install it
  4. python-2.7.amd64 --> install it
  5. npm config set python C:\Python27 (python27 path) 
  6. npm install --global --production windows-build-tools

 Regards,

Islam