Troubleshooting login issues with Cody on VS Code for Linux

Scenario

On Linux, a user may encounter an issue where they are unable to login to Cody using their Sourcegraph instance URL. A typical scenario would be - A user, using the correct source instance URL and an access token, observes that the sign-in process just hangs and Cody cannot start.

 

When looking at the logs, the following can be seen:

█ ContextProvider:onConfigurationChange:
█ logEvent: CodyVSCodeExtension:auth:failed
█ logEvent: CodyVSCodeExtension:auth:clickOtherSignInOptions
█ AuthProvider:signinMenu: signin
█ logEvent: CodyVSCodeExtension:login:clicked
█ logEvent: CodyVSCodeExtension:auth:failed
█ logEvent: CodyVSCodeExtension:auth:clickOtherSignInOptions
█ AuthProvider:signinMenu: signin
█ logEvent: CodyVSCodeExtension:login:clicked
█ logEvent: CodyVSCodeExtension:auth:clickOtherSignInOptions
█ AuthProvider:signinMenu: signin
█ logEvent: CodyVSCodeExtension:login:clicked
█ logEvent: CodyVSCodeExtension:auth:selectSigninMenu {"menuID":"token"}
█ Cody:publishConfig: configForWebview {
"os": "darwin",
"arch": "arm64",
"homeDir": "/Users/shambergl",
"uriScheme": "vscode",
"appName": "Visual Studio Code",
"extensionVersion": "0.6.4",
"isAppInstalled": false,
"isAppRunning": false,
"hasAppJson": false,
"debugEnable": true,
"serverEndpoint": "https://example.sourcegraph.com/",
"pluginsEnabled": false,
"pluginsDebugEnabled": true
}
█ ContextProvider:onConfigurationChange:
█ logEvent: CodyVSCodeExtension:auth:failed
█ logEvent: CodyVSCodeExtension:auth:fromToken {"success":false}

 

Problem

The likely cause of this is on networking where Cody is unable to reach the instance URL due to possible underlying networking rules related to SSL certificates.

 

Solution/Workaround

To confirm, the user can try logging into their instance via the src-cli tool in their local terminal. If successful, then this points to an issue with strict enforcing of TLS rules. 

 

To resolve this via a workaround:

  1. Completely quit VS Code and all it's instances.
  2. Run echo "export NODE_TLS_REJECT_UNAUTHORIZED=0" >> ~/.bashrc in terminal.
  3. Restart VS Code and sign in again.

Additional Information

NODE_TLS_REJECT_UNAUTHORIZED is an environment variable used in Node.js to control the behavior of TLS (Transport Layer Security) connections, specifically when making HTTPS requests. It determines whether Node.js should reject SSL/TLS connections with self-signed or invalid certificates.

When NODE_TLS_REJECT_UNAUTHORIZED is set to the value of 0, Node.js will not reject connections with invalid SSL certificates. This means that if you make an HTTPS request to a server with a self-signed certificate or a certificate that cannot be validated, the connection will still be established, and you can potentially transmit data over an insecure connection. Setting this variable to 0 effectively disables certificate validation.

 

 

Was this article helpful?
0 out of 0 found this helpful

Articles in this section