sasjs / cli

Command line interface for creating, compiling, and building SAS® projects
https://cli.sasjs.io
MIT License
37 stars 5 forks source link

ERROR An error has occurred when deploying services: Root folder /Public was not found. #1181

Closed allanbowe closed 2 years ago

allanbowe commented 2 years ago

After extensive debugging it was identified that the above error was thrown due to certificate errors whilst connecting from a Windows machine. This was discovered after installing httpToolkit and noticing a 502 response (or more accurately, no request was made).

There are a few actions needed here:

1) The CLI should throw a more meaningful error message if the correct http response is not received 2) The CLI should check the context of the runtime (ie, OS, shell type) and offer appropriate advice (eg to add httpAgentOptions in sasjsconfig.json, or provide a link to more secure approaches)

Many SAS customers use Self-Signed certificates without intermediate/ chain certificates. On windows, this is acceptable in the CMD prompt but NOT in git bash (at least, not without further, manual steps).

allanbowe commented 2 years ago

Example of certificate issues: https://www.sslshopper.com/ssl-checker.html#hostname=https://4gl.viyacloud.sas.com/SASLogon/oauth/token

image

saadjutt01 commented 2 years ago

If you are facing following error: unable to verify the first certificate

The certificate chain is incomplete.

It means that the webserver you are connecting to is misconfigured and did not include the intermediate certificate in the certificate chain it sent to you.

Perform following steps to get: Using 4gl.viyacloud.sas.com as server URL in this case.

openssl s_client -connect 4gl.viyacloud.sas.com:443 -servername 4gl.viyacloud.sas.com | tee logcertfile
openssl x509 -in logcertfile -noout -text | grep -i "issuer"
# use URI from last step
# for this case, using "http://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1-1.crt"
curl --output intermediate.crt http://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1-1.crt
openssl x509 -inform DER -in intermediate.crt -out intermediate.pem -text

Read further: (1. How do I get intermediate certificate?):

Now use this intermediate certificate in sasjsconfig.json with httpsAgentOptions image

ghost commented 2 years ago

:tada: This issue has been resolved in version 3.12.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

allanbowe commented 2 years ago

More info on Cert Setup added here: https://cli.sasjs.io/auth/#tls-config