Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to use this over ssh? #2

Closed
OmgImAlexis opened this issue Mar 22, 2019 · 8 comments
Closed

Any way to use this over ssh? #2

OmgImAlexis opened this issue Mar 22, 2019 · 8 comments

Comments

@OmgImAlexis
Copy link

I have a remote server that I'd love to use this where I can use my local instance of VS Code, Chrome, etc.

@hediet
Copy link
Owner

hediet commented Mar 22, 2019

How would the chrome window popup work in this scenario?

If you redirect certain ports on your ssh session, it should already work out of the box using the vscode rpc server extension.
Admittedly, one of the ports you would have to forward is random, but this is by design.

Would it be sufficient if you could specify a range of ports that the debugger-proxy can choose from? Then you can forward all ports in this range.

@OmgImAlexis
Copy link
Author

That sounds perfect.

@hediet
Copy link
Owner

hediet commented Mar 22, 2019

You can now specify ports with debugProxyPort:

require("...\\easy-attach\\")({  debugProxyPort: [12340,12341, 12342 ] });

You then have to forward these ports from your dev machine to your server.
Then, with the vscode rpc server extension, you also have to forward port 56024 from your server to your dev machine.
This way, the server can notify vscode and vscode can connect to the debug proxy.

I don't have a remote linux at hand and my virtual linux has problems with port forwarding, so please let me know if this works!

@hediet
Copy link
Owner

hediet commented Mar 26, 2019

Closing this issue. Please let me know if it does not work, I'll reopen then.

@hediet hediet closed this as completed Mar 26, 2019
@OmgImAlexis
Copy link
Author

OmgImAlexis commented Apr 6, 2019

Sorry only just got around to testing this and it seems it doesn't work. I've updated to the latest 1.0.0.

root@Devon:/mnt/disks/code/api# node -r esm
> import easyAttach from '/usr/local/share/.config/yarn/global/node_modules/easy-attach'
> easyAttach({ debugProxyPort: [12340,12341, 12342 ] })
Debugger listening on ws://127.0.0.1:38967/877fca11-3a6f-499b-b199-eebc479c63d1
For help, see: https://nodejs.org/en/docs/inspector
(node:25174) UnhandledPromiseRejectionWarning: TypeError: get_port_1.default is not a function
    at run (/usr/local/share/.config/yarn/global/node_modules/easy-attach/dist/debugger-proxy/entry.js:66:40)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/easy-attach/dist/debugger-proxy/entry.js:72:1)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

(node:25174) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25174) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I get the same issue with and without esm so I doubt that's causing it.

root@Devon:/mnt/disks/code/api# node
> require('/usr/local/share/.config/yarn/global/node_modules/easy-attach')({ debugProxyPort: [12340,12341, 12342 ] })
Debugger listening on ws://127.0.0.1:43315/5f1098ca-2c1e-41f3-85a0-f37e7edf4564
For help, see: https://nodejs.org/en/docs/inspector
(node:25257) UnhandledPromiseRejectionWarning: TypeError: get_port_1.default is not a function
    at run (/usr/local/share/.config/yarn/global/node_modules/easy-attach/dist/debugger-proxy/entry.js:66:40)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/easy-attach/dist/debugger-proxy/entry.js:72:1)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

(node:25257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@OmgImAlexis
Copy link
Author

get-port should be accessed as get_port_1() not get_port_1.default, sounds like a typescript issue. 🤔

@OmgImAlexis
Copy link
Author

I haven't used typescript in a while but I think if you change this line to import * as getPort from 'get-port'; it should fix it.

import getPort from "get-port";

@hediet hediet reopened this Apr 6, 2019
@hediet
Copy link
Owner

hediet commented Apr 6, 2019

The type definitions of get-port said there is a default export, even though there isn't. They have been fixed recently.
Its Strange though that I didn't notice this when I tested it.

Should be fixed in 1.1.0 now.

@hediet hediet closed this as completed Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants