'Remotely force kill a shared ngrok session forwarding a React app
I share an ngrok account with my coworkers. We are using it to develop a React application (npx create-react-app). We are all using UNIX-like systems. Quite often I go to spin up an http tunnel and I am met with the message
Your account '*****@*********.com' is limited to 1 simultaneous ngrok client session.
Active ngrok client sessions in region 'us':
- ******************************** (**.***.***.***)
ERR_NGROK_108
Or if I am logged in with my own account, but trying to use the same tunnel, I get
The tunnel 'https://*****.ngrok.io' is already bound to another
tunnel session
ERR_NGROK_334
Both of these messages mean my coworker (who I know for a fact is currently asleep) left their ngrok session running. I would like to execute a simple command that tells their system to kill ngrok processes.
Is there an ngrok CLI command to force kill a session running on another machine?
Based on my research so far, I think the answer is no. But please tell me if I am wrong.
Is there a safe way to remotely execute a system command to kill ngrok sessions?
I found a beautiful solution that some Rails developers came up with to remotely kill ngrok sessions in a Rails API.
Their strategy is to include an API endpoint (only in development mode) that executes the system command killall ngrok to kill all ngrok processes on that system.
Is there a way to remotely execute system commands with our client-side rendered React application?
My gut tells me no, at least not without spinning up a server to receive the kill request.
My thought is, maybe I can create a proxy server for my React application using Node and Express. That server can do exactly two things: act as a proxy to the React app, and kill ngrok when it receives a specific request. In the past I have built a proxy server in the same git repository as my React app, so I think this solution is attainable.
How would you recommend I move forward?
So far I have not been able to find an example of this online. I would hate to waste my time building a low quality version of something that already exists.
I see there is an ngrok npm package... maybe that could be useful.
Any thoughts on best practices when configuring/coding the proxy server are much appreciated.
Or if you think I am overcomplicating things, let me know.
Thanks!
Solution 1:[1]
Ngrok now has a beta API (for paid plans only I believe?) that can remotely stop agents. Their dashboard now also offers the same functionality, even if you are not part of the beta.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adrien |
