Question

vscode.dev tunnel connection disconnects

I use vscode.dev to develop a small app. To do this I have installed nodejs and the code tunnel app on my droplet. Everything works fine, I can edit, compile, and debug my app from vscode.dev.

My problem is that after some time vscode.dev loses connection to my droplet. I have discovered that I get the connection to work again, by opening a console to my droplet from the digital ocean site.

I wonder how I can stop my droplet from disconnecting vscode.dev? So that I don’t have to keep the console open all the time…

thanks, sam


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

It looks like I found a solution. sudo loginctl enable-linger $USER

alexdo
Site Moderator
Site Moderator badge
November 21, 2024

Heya, @samdejonghhepworth

The issue you’re facing is likely related to your droplet terminating idle connections or entering a low-activity state.

You can try using a keep-alive option when starting Code Tunnel:

code-tunnel --keep-alive

If this option doesn’t exist for your version, check the Code Tunnel documentation for updated flags.

Hope that this helps!

Bobby Iliev
Site Moderator
Site Moderator badge
November 20, 2024

Hey!

The most common cause for this issue is SSH timing out due to inactivity. There was a similar discussion reported here and the user was able to get it working by increasing that in their SSH config:

https://www.digitalocean.com/community/questions/how-to-increase-ssh-connection-timeout

You can try to configure your Droplet’s SSH server.

  • Open the SSH configuration file on your droplet:
sudo nano /etc/ssh/sshd_config
  • Look for or add the following lines to keep the connection alive:
ClientAliveInterval 120
ClientAliveCountMax 720
  • And finally restart the SSH service to apply the changes:
sudo systemctl restart sshd

Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.