bubenshchykov / ngrok

Expose your localhost to the web. Node wrapper for ngrok.
https://ngrok.com
2.32k stars 316 forks source link

Windows 10 process creation appears to need a time delay before attempting to create tunnels #248

Open jamesaduncan opened 3 years ago

jamesaduncan commented 3 years ago

I am, unfortunately, having to write code on Windows 10 at the moment. When I try to connect() ngrok fails:

(node:24516) UnhandledPromiseRejectionWarning: NgrokClientError at NgrokClient.request (C:\Users\James Duncan\Dev\laddr\node_modules\ngrok\src\client.js:47:23)

This seems to occur because the web server is not up and listening in time before the post to api/tunnels is fired.

With a 500ms delay after the call to spawn, everything seems to work.

philnash commented 2 years ago

Hi @jamesaduncan, this module waits 200ms between each attempt to connect and tries up to 100 times. Is there some underlying problem, like an error being thrown that isn't expected. Or are you calling connect from somewhere else? I know it's been a while since you posted this, but if you could share the code you were using, that would help.

If you worked around this or fixed it in some other way, please do let me know and I will close this issue.