C3 AI Documentation Home

C3 AI VS Code Extension Troubleshooting

This topic describes how to troubleshoot common Visual Studio Code Extension (VSCE) issues.

If you're experiencing issues connecting to your environment, or if you're running into issues syncing your package, you should try these initial steps to restore your connection:

  • Ensure your environment is in a running state
  • Ensure you have correct read and write permissions for your development space
  • Resync your packages by right-clicking your package in VSCE and choose Sync Packages
  • Ensure your software versions are up to date. See compatible software versions on the Supported Versions per Release page.
  • Restart VS Code

The following sections go into more detail about specific issues you may be having.

Reopen extension tab

If you close the tab to VSCE, you can open it again with the VS Code Command Palette.

  1. In VS Code, press CMD + Shift + P on Mac, or Ctrl + Shift + P on Windows to open the Command Palette.
  2. Type in C3: Open Login Page and press Enter.

SSL and certificate issues

If you have trouble connecting to your environment, you may have SSL or certificate issues. The following section provides guidance on troubleshooting your connection and certificate settings to ensure you have a valid connection to your cluster.

Example error code: self signed certificate in certificate chain

Find relevant certificates

To see which certificates you should use, you can open the certificate settings in your browser while accessing Studio. You should be using the Chrome browser.

  1. Navigate to C3 AI Studio homepage for your cluster.

  2. Click on the site information icon next to the URL path. This should be on the top left of your browser window.

  3. Select Connection is secure to open connection details.

    Browser connection details menu

  4. Select Certificate is valid.

    Certificate is valid menu item highlighted in menu

  5. Select the Details tab. You can see the Certificate Authority for all the required certificates you need to start your connection to your environment.

    Connection details popup window

Add missing certificates

You can access all certificates in the chain for your cluster using the openssl command. The following example finds the certificates for a training cluster, uses the 443 port, and saves the certificates to cert_chain.txt:

Text
openssl s_client -connect stggketrn4.c3training.cloud:443 -showcerts > cert_chain.txt
  1. Save each certificate in its own .pem file. Certificates start with ------BEGIN CERTIFICATE end with END CERTIFICATE-----.
  2. Consult your IT department for a valid outgoing port for your connection.
  3. Add certificates to your system trust store.
    • For Mac, run the following code in the terminal to add each certificate to your trust store. For each certificate, replace mycert.pem for each .pem file you saved.

      Text
      sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain mycert.pem

      Then open the Keychain Access application and set the When using this certificate: field to Always Trust for each certificate. See the following screenshot for this step:

      Screenshot of how to trust certificates in Mac OS

    • For Windows, add each certificate using the Certificate Manager application for Windows.

Configure Node to use certificates

After you add missing certificates, specify the path for your certificates for Node.js. Certificate paths are environment variables that you must set in the shell configuration file to ensure that the server consistently uses the certificates when establishing secure connections.

for Mac OS or Linux

For Mac OS or Linux, run the following in your terminal to set the certificate paths, replacing <path_to_cert_chain> with the path to your certificates:

  • If you use bash, then run ~/.bashrc export NODE_EXTRA_CA_CERTS="<path_to_cert_chain>.
  • If you use zsh, then run ~/.zshrc export NODE_EXTRA_CA_CERTS="<path_to_cert_chain>.

For Windows

Complete the following steps for Windows:

  1. Open System Properties.
  2. Navigate to Environment Variables.
  3. Select Edit the system environment variables.
  4. For User Variables, select New....
  5. Enter the following values: a. Variable name: NODE_EXTRA_CA_CERTS b. Variable value: <path_to_cert_chain>

Ignore certificate checks

If you are still unable to resolve certificate errors for your machine, you may need to ignore certificate checks. This is not recommended as ignoring certificate checks may expose you to security vulnerabilities.

Enter the following commands in terminal to bypass VS Code certificate checks:

Text
# Ignore NODE certificate checks
set NODE_TLS_REJECT_UNAUTHORIZED=0

npm config set strict-ssl false --global

# Ignore VS Code certificate checks
code --ignore-certificate-errors

Server authentication issues

Your connection may fail due to a stale authentication token. You can remove your authentication token using the Command Palette in VS Code:

  1. In VS Code, press CMD + Shift + P on Mac, or Ctrl + Shift + P on Windows to open the Command Palette.
  2. Type in C3: Remove Auth Token and press Enter.
  3. Type in your environment URL and press Enter.

If the issue persists, you can set the token manually through VS Code.

  1. Go to your environment console and run the following command:

    JavaScript
    Authenticator.generateActionAuthToken()
  2. Go to VS Code and type shift command p. enter set auth token

  3. choose your environment

  4. paste key in

  5. In your output you should see successfully set token

npm package issues

If you encounter npm error ENODATA, you may be missing some required data or metadata, or you may be using an outdated version of node.

  1. Try cleaning your cache. Run the following code in Terminal:

    Text
    npm cache clean --force
  2. If you're unable to access npm packages downloaded during runtime installation, you may need to uninstall and reinstall node. Depending on how you installed node, you may need to use different methods to uninstall and reinstall node.

    • If you used nvm to install node, use the following command to uninstall:

      Text
      nvm uninstall --latest
    • If you used the official installer to install node, use the following command to uninstall:

      Text
      sudo rm -rf /usr/local/lib/node_modules /usr/local/include/node /usr/local/bin/node
    • If you used the brew to install node, use the following command to uninstall:

      Text
      brew uninstall node

    For more information on node, see How to install Node.js in the Node.js documentation.

Local permission issues

If you see Failed to execute npm install or something similar, you may be experiencing permission issues for your machine.

In Terminal, navigate to the local cache for npm. This directory is typically the .npm directory and is hidden.

For Mac, try running sudo chown -R 501:20 "/Users/User/.npm" in Terminal to change directory ownership.

For Windows, try opening VS Code as an administrator by right-clicking the application and selecting "Run as administrator".

Unreachable environment

Based on your cluster administrative settings, your environment may have automatically hibernated activity. You may need to restart or resume your hibernated environment to resume development.

  1. Navigate to C3 AI Studio in your browser.
  2. Select your environment in the Current environment dropdown.
  3. Select the 3 ellipses icon next to the environment. Choose Resume environment.
  4. Wait for your environment to resume. If your environment has a green check mark next to its name, it is in the running state.

Connection fails in air-gapped environment because of Keyring

Keyrings are storage systems that manage sensitive information, such as passwords, tokens, and encryption keys. Connection issues to air-gapped environments can result from incomplete keyring configurations.

For your GNOME Keyring on a Linux machine, you can verify if your GNOME Keyring is installed and running. Contact your customer IT admin for more troubleshooting instructions regarding your GNOME Keyring.

  1. which gnome-keyring-daemon checks if your GNOME Keyring is installed
  2. ps aux | grep gnome-keyring checks if your GNOME Keyring is running

Dev app inaccessible

The Dev application is where the VS Code Extension package launches from. If you can't start your Dev application, you may need to start it manually through the environment Console.

JavaScript
DevEnv.ensureDevApp()

Adjust reconnect to network attempts

If you lose your internet connection, the extension attempts to reconnect five times, with each attempt lasting for 30 seconds.

When VSCE detects the loss of connection, it provides a notification and attempts to reconnect.

You can change the number of attempts:

  1. Open the VS Code settings. For Mac OS, you can use the keyboard shortcut (⌘ + ,).
  2. Enter c3ai.reconnectAttempts in the search bar, or select Extensions > C3 AI.
  3. Under C3ai: Reconnect Attempts, enter the number of reconnect attempts.

Streaming errors

If you see "Failed to stream" errors while trying to sync to environment, it could be that you need to enable streaming after a certain size, or reduce batch size.

Note: You must run the following command in dev app only. Running this command in env/c3 does not work.

Note: Enabling this option is risky. Disabling streaming may cause out of memory errors while syncing.

JavaScript
// Enable streaming after 10000000 KB (10 GB)
IdeConfig.setConfigValue('maxBufferedWriteFileSize', 10000000); 
IdeConfig.setConfigValue('maxBufferedReadFileSize', 10000000);

// Reduce batch size
IdeConfig.setConfigValue('downloadBatchSize', 100); 
IdeConfig.setConfigValue('upsertBatchSize', 25);

Socket hang up

If you see socket hang up issues, check if you have sym links in your package. Files from the sym links should be located in the root directory of your package, and can't link to other packages.

Example error message: Error: socket hang up

Stale package issues

If you see Java compilation errors or other code-gen issues, you may be experiencing stale Pkg issues. For example, you may see errors that involve declarations of the same Type.

Text
Multiple type declarations with the same name `<TYPE NAME>` were found.

If your metadata changes are not being synced, you may need to manually resync your packages.

To sync your packages, right-click the package you want to sync, and choose Sync Packages.

Force resync all

If you sync your package, but you still notice stale package issues, you can try force resyncing your package.

Note: Force resync all forcibly resyncs and re-validates everything in your package. Save your work appropriately.

  1. While synced to your environment, press CMD + Shift + P on Mac, or Ctrl + Shift + P on Windows to open the Command Palette.
  2. Type in C3: Force Resync All Packages and press Enter.

Contact your IT admin

If you are connecting from a corporate laptop, or if you're connecting to non-C3 hosted cluster, you may need to reach out to your specific company IT admins for additional support in troubleshooting your connection issues.

Examples of configurations that can cause connection issues:

  • Firewall settings
  • VPN settings
  • Network proxies
  • Network security software
  • Cluster whitelists for IP addresses
Was this page helpful?