3

Trying to install Visual Code IDE in VM Instance. After running the code-server, while checking view on browser, it is giving an error. Error: Could not connect to Cloud Shell on port 8080. Ensure your server is listening on port 8080 and try again.

enter image description here

reference link to install VS Code in GCC: https://medium.com/google-cloud/how-to-run-visual-studio-code-in-google-cloud-shell-354d125d5748

TRD Saifuddin
  • 41
  • 1
  • 1
  • 2
  • 1
    Your code is listening on `localhost`. This means that you cannot access the program from outside Cloud Shell. You can verify that your program is running by opening another Cloud Shell tab and running `curl -i http://localhost:8080/` You will see the output of your program. `localhost` is the loopback device. To fix the problem, change the listening port from `localhost` to `0.0.0.0`. – John Hanley Nov 28 '19 at 17:08

2 Answers2

1

Try openning on your browser: http://[your-external-ip]:8080/

Its important to change the default "https" to "http".

I also added the port 8080 on my firewall permisions on gcp.

0

You should set your host to 0.0.0.0. When you start the server, your command could be like this:

./code-server --no-auth --port 8080 --host 0.0.0.0

And everything should work fine. Try it :D

Puteri
  • 3,348
  • 4
  • 12
  • 27
  • I tried running with the above mentioned command. still it's not working "Preview on Port 8080" - it's giving an error "400(Not Found)!! The requested URL was not found on this server" – TRD Saifuddin Nov 30 '19 at 05:51
  • You tried to use `https://8080-dot-YOURID-dot-devshell.appspot.com/login` as the tutorial you're using suggests? – Puteri Dec 02 '19 at 18:18