localtunnel: Crashing after a few minutes
events.js:85
throw er; // Unhandled 'error' event
^
Error: connection refused: localtunnel.me:37302 (check your firewall settings)
at Socket.<anonymous> (/usr/local/lib/node_modules/localtunnel/lib/TunnelCluster.js:45:32)
at Socket.emit (events.js:107:17)
at net.js:451:14
at process._tickCallback (node.js:355:11)
I keep getting this error repeatedly on multiple instances of localtunnel but I can’t really pin down what’s causing it. I can’t imagine that the connection is actually getting refused because the tunnel starts up and works normally for however many minutes until it decides to stop working. Is there any way to get it to retry instead of just crashing and closing the tunnel? Right now this is making it really unreliable to use localtunnel because I can’t maintain the connection for any extended period of time.
Thoughts? Solutions?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 20
- Comments: 45 (4 by maintainers)
Commits related to this issue
- Starting testee server and sauce labs tunnel from travis.yml This simplifies the sauce labs script and hopefully helps with reliability since the localtunnel node package seems to be pretty inconsist... — committed to canjs/canjs by phillipskevin 8 years ago
- Starting testee server and sauce labs tunnel from travis.yml This simplifies the sauce labs script and hopefully helps with reliability since the localtunnel node package seems to be pretty inconsist... — committed to canjs/canjs by phillipskevin 8 years ago
ngrok is great, but I’m not paying $5/month just to get custom subdomains.
I use a Ruby script that restarts localtunnel when it crashes (edit: fixed bug that Dave84c pointed out):
I’ve been running this for a couple of days, and it’s restarted it 218 times. There must be occasional disruptions, but I haven’t noticed them.
ETA: You’ll need Ruby to run that script. Ruby comes on OSX and on most Linux distributions (not sure about Windows), so it should just run if you save it as a Ruby file. For example, if you save it as localtunnel.rb, you should be able to run it with:
ruby localtunnel.rb --port 3000 --subdomain yourdomainhere
I vote for leaving this issue open until it’s fixed. Closing it makes it seem like localtunnel is more stable than it is. People end up frustrated as a result.
A simple bash script to restart it every time it crashes
#!/bin/bash
function localtunnel { lt -s subdomain --port port_number }
until localtunnel; do echo “localtunnel server crashed” sleep 2 done
+1 for @dreki. Keep this issue open.
Hey @michaelkeenan, I think there is an error in the Code.
opts.on('-s', '--subdomain subdomain', 'Subdomain') do |name| options[:subdomain] = subdomain; end
shouldnt the block parameters match the option: name => subdomain, age =>port ?
Cheers, Dave