philnash/ngrok-for-vscode

Using this extension inside a devcontainer

ijaouani opened this issue · 7 comments

Hello,

I am using VSCode with Remote Containers : https://code.visualstudio.com/docs/remote/containers.

It seems that this extension is not working in this condition: The download of ngrok works fine but the ngrok: set auth token command seems to do nothing. Config file ngrok.yml is not created.

image

The workaround I have found is to manually set it by using :

root ➜ ~/.../extensions/philnash.ngrok-for-vscode-1.9.2/dist/bin $ ./ngrok authtoken <mytoken>
Authtoken saved to configuration file: /root/.ngrok2/ngrok.yml

But this is really not the way I should do it.

Any idea ? Glad to help if you need logs or something.

Can you tell me what the underlying version of the ngrok executable is? If you start a tunnel it should show up in the status bar.

v2.3.40

Other things : I see in your codebase that I should see this message when using the auth token command:

return window.showInformationMessage(
      'Your auth token has been saved to your ngrok settings.'
    );

And nothing is displayed on my side.

Ok I have found an easy way for replication with official Microsoft devcontainer sample:

  1. Open VSCode and install Remote - Containers extension
  2. Use Remote-Containers: Try a Development Container Sample...
  3. Choose node
  4. Run the app (F5)
  5. The web server is available on port 3000 and you can access it locally
  6. Install ngrok-for-vscode extension
  7. ngrok set auth token with your private token

Here nothing happen no message - no config file created.
If you try to use ngrok start on 3000:

image

The error from vscode developer tools:

image

The root cause is the path which is not correct (dist is missing):

image

So you're able to start ngrok in the container using the extension, but you're not able to set the authtoken from the extension?

Exactly. Reproductible scenario described just before.

I just come by this issue, for me I think the issue is I've got LiveServer running in a devcontainer, but you can only reach it using http://127.0.0.1:[port] on the host machine, which makes sense as localhost won't know about the devcontainer.

I think a potential fix for this is allowing a user to specify a non-local url, this is supported by ngrok

https://ngrok.com/docs/secure-tunnels/non-local