Help Center/ ModelArts/ Troubleshooting/ DevEnviron/ Failures to Access the Development Environment Through VS Code/ What Do I Do If Error Message "XHR failed" Is Displayed When a Remote Notebook Instance Is Accessed Through VS Code?
Updated on 2024-12-30 GMT+08:00

What Do I Do If Error Message "XHR failed" Is Displayed When a Remote Notebook Instance Is Accessed Through VS Code?

Possible Cause

The error message "XHR failed" is displayed when the VS Code connects to the remote notebook.

Cause Analysis

The VS Code Server cannot be automatically downloaded because the network in the environment is faulty. Install the VS Code Server manually.

Solution

  1. Open VS Code, choose Help > About, and record the ID of Commit.
  2. Check the system architecture of the image used for creating a notebook instance. You can open Terminal in the notebook instance and run the uname -m command to view the system architecture.
  3. Download vscode-server of the corresponding version based on the commit code and notebook instance image architecture.

    If the error message "Not Found" is displayed, download another version of VS Code and install it locally. Currently, Vscode-1.86.2 is recommended.

    • If the instance architecture is x86_64, click the following link to manually change the commit code (delete angle brackets when replacing the commit code), and download the vscode-server-linux-x64.tar.gz file using a browser.
      https://update.code.visualstudio.com/commit:<Commit code>/server-linux-x64/stable
    • If the instance architecture is aarch, click the following link to manually change the comment-id (remove the angle brackets when replacing the commit-id), and download the vscode-server-linux-arm64.tar.gz file using a browser. After the download is complete, rename the downloaded vscode-server-linux-arm64.tar.gz file vscode-server-linux-x64.tar.gz.
      https://update.code.visualstudio.com/commit:<Submitted ID Code>/server-linux-arm64/stable

    For example, if the commit-id is 863d2581ecda6849923a2118d93a088b0745d9d6 and the OS architecture is x86_64, run the following command:

    https://update.code.visualstudio.com/commit:863d2581ecda6849923a2118d93a088b0745d9d6/server-linux-x64/stable
  4. Upload the downloaded vscode-server-linux-x64.tar.gz file to the /home/ma-user/work directory of the ModelArts instance.

    Run the following command and specify commitId: (Note: Run the command in Terminal of Notebook. Delete angle brackets when replacing commit-id.)

    commitId=<Submitted ID Code>
    mkdir -p /home/ma-user/.vscode-server/bin/$commitId
    tar -zxvf vscode-server-linux-x64.tar.gz -C /home/ma-user/.vscode-server/bin/$commitId  --strip=1
    chmod 750 -R /home/ma-user/.vscode-server/bin/$commitId
  5. Close the VS Code and open the VS Code again on the notebook instance list page. (Note: You need to close the local vscode. Otherwise, a message indicating that multiple installation processes are running may be displayed.)