localtunnel / server

server for localtunnel.me
https://localtunnel.me
MIT License
3.01k stars 976 forks source link

help with subdomain #79

Closed coffeeboy7411 closed 6 years ago

coffeeboy7411 commented 6 years ago

try to set subdomain in the api , the it always failed and prompt: ( P.S. it works fine in command line)

TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined at Url.parse (url.js:106:11) at Object.urlParse [as parse] (url.js:100:13) at Tunnel._init (/Users/tony/Desktop/Brainstation/Lab/restDemo/node_modules/localtunnel/lib/Tunnel.js:36:24) at Tunnel.open (/Users/tony/Desktop/Brainstation/Lab/restDemo/node_modules/localtunnel/lib/Tunnel.js:138:10) at localtunnel (/Users/tony/Desktop/Brainstation/Lab/restDemo/node_modules/localtunnel/client.js:16:12) at Object. (/Users/tony/Desktop/Brainstation/Lab/restDemo/studentExample.js:145:14) at Module._compile (module.js:641:30) at Object.Module._extensions..js (module.js:652:10) at Module.load (module.js:560:32) at tryModuleLoad (module.js:503:12)

The api code below: var tunnel = localtunnel('8080', 'testcoffeeboy', function (err, tunnel) { if (err) { console.log(err) }

tunnel.url
console.log(tunnel.url)

});

tunnel.on('close', function () {

});

William-An commented 6 years ago

The opts param in tunnel class should be an object but not a string. You can try to delete the 'testcoffeeby' or use {subdomain:'testcoffeeby'} instead.

btw. This repo is for localtunnel-server not localtunnel. You should refer to https://github.com/localtunnel/localtunnel/issues for help.