question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: built-in extensions "simple-browser" not work

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS
  • Remote OS: Ubuntu
  • Remote Architecture: amd64
  • code-server --version: 4.5.1

Steps to Reproduce

  1. create kind cluster
  2. deploy code-server with deployment
---
apiVersion: v1
kind: Service
metadata:
 name: code-server
 namespace: code-server
spec:
 ports:
 - port: 80
   targetPort: 8080
 selector:
   app: code-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: code-server
  name: code-server
  namespace: code-server
spec:
  selector:
    matchLabels:
      app: code-server
  replicas: 1
  template:
    metadata:
      labels:
        app: code-server
    spec:
      containers:
      - image: codercom/code-server:latest
        imagePullPolicy: Always
        name: code-server
        env:
        - name: PASSWORD
          value: "your_password"
  1. port-forward code-server and access
  2. clone https://github.com/cyclic-software/starter-nextjs.git repo
  3. run yarn run dev, and use command+shift+p open sample browser
  4. access 127.0.0.1:3000, and it show connection refuse

Expected

This plugin is built-in plugin, and can access nextjs app in sample browser.

Actual

Connection refuse.

Logs

[2022-08-03T08:19:08.250Z] info Wrote default config file to ~/.config/code-server/config.yaml [2022-08-03T08:19:08.462Z] info code-server 4.5.1 97d170331b51ee75c8e4bbdab23c755e3eeaaa8c [2022-08-03T08:19:08.462Z] info Using user-data-dir ~/.local/share/code-server [2022-08-03T08:19:08.471Z] info Using config file ~/.config/code-server/config.yaml [2022-08-03T08:19:08.471Z] info HTTP server listening on http://0.0.0.0:8080/ [2022-08-03T08:19:08.471Z] info - Authentication is enabled [2022-08-03T08:19:08.471Z] info - Using password from $PASSWORD [2022-08-03T08:19:08.471Z] info - Not serving HTTPS [08:19:56] Extension host agent started. [08:19:56] [127.0.0.1][6e69e306][ManagementConnection] Unknown reconnection token (never seen). [08:19:56] [127.0.0.1][6413cb24][ExtensionHostConnection] Unknown reconnection token (never seen). [08:19:58] [127.0.0.1][533e507c][ManagementConnection] New connection established. [08:19:58] [127.0.0.1][d5653c2d][ExtensionHostConnection] New connection established. [08:19:58] [127.0.0.1][d5653c2d][ExtensionHostConnection] <80> Launched Extension Host Process. [08:20:10] Using the in-memory credential store as the operating system’s credential store could not be accessed. Please see https://aka.ms/vscode-server-keyring on how to set this up. Details: Cannot find module ‘…/build/Release/keytar.node’ Require stack:

  • /usr/lib/code-server/lib/vscode/node_modules/keytar/lib/keytar.js
  • /usr/lib/code-server/lib/vscode/out/bootstrap-amd.js
  • /usr/lib/code-server/out/node/util.js
  • /usr/lib/code-server/out/node/cli.js
  • /usr/lib/code-server/out/node/entry.js File not found: /usr/lib/code-server/lib/vscode/out/vs/workbench/contrib/webview/browser/pre/baidu.com File not found: /usr/lib/code-server/lib/vscode/node_modules/vscode-regexp-languagedetection/dist/index.js File not found: /usr/lib/code-server/lib/vscode/out/vs/workbench/contrib/webview/browser/pre/baidu.com File not found: /usr/lib/code-server/lib/vscode/node_modules/@vscode/vscode-languagedetection/dist/lib/index.js.map

Screenshot/Video

image

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

I’m not using HTTPS!!! When I use curl access 127.0.0.1:3000, it works, but can’t access with sample browser. Here is same issues but close. #3495

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
molszewscommented, Aug 24, 2022

I think the expectation here is that the port-forward is not needed as long as you are trying to browse using the Simple Browser, so the traffic originates from pod to code-server and then the browser just renders it.

1reaction
code-ashercommented, Aug 24, 2022

The issue says it cannot be reproduced in Codespaces but it reproduces for me. I ran python -m http.server and then opened the simple browser to http://127.0.0.1:8000.

The expectation makes sense to me but I believe the browser implementation is nothing more than an iframe so it will unfortunately resolve from your local machine.

To fix like @jsjoeio said I think you will need to forward port 3000. Or you could try opening the port through code-server’s proxy instead like with http://localhost:8080/proxy/3000/.

If the simple browser extension proxied itself that would be ideal though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I open a browser window in a visual studio code ...
Open the pallet (Ctrl + Shift + P); Select "Simple Browser: Preview" ... You can use the Live Preview extension from Microsoft:.
Read more >
Web Extensions - Visual Studio Code
Learn how to run extensions in Visual Studio Code for the web and the web extension host.
Read more >
Visual Studio Code Browser Preview Extension - YouTube
Did you know you can view a live-reloading browser preview right inside of Visual Studio Code? Well, with the Browser Preview extension, ...
Read more >
342712 - force-installed extension not disabled in incognito ...
My guess is no, in which case this is a bad bug. Comment 3 by schedule mea. ... How does an extension specify...
Read more >
VS Code's built-in browser : r/vscode - Reddit
Open the command palette (⇧+Ctrl/⌘+P) and write Simple Browser: Show. When should I use it? When you don't need debugging or the browser's ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found