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

upg login on fresh linux vm without xdg-open cause error #14

Open
kaxing opened this issue Dec 6, 2022 · 5 comments
Open

upg login on fresh linux vm without xdg-open cause error #14

kaxing opened this issue Dec 6, 2022 · 5 comments

Comments

@kaxing
Copy link

kaxing commented Dec 6, 2022

Trying out gsh and bumping into this inside a fresh vm; While there is no xdg-open installed.
Can be easily fix by install the package but figure might be good to put a note here.

  Attempting to open browser. Please visit this link if it does not open automatically.

  https://gptlabs.us.auth0.com/authorize?client_id=I3rJAbl7D09DuYG6dGeYWtBtpuGyeZrI&redirect_uri=http%3A%2F%2Flocalhost%3A23462&audience=https%3A%2F%2Fgptlabs.us.auth0.com%2Fapi%2Fv2%2F&code_challenge=OWb0vyyU9o1pTOeJIm8P8Vc98KMWCrcEhHn7BlRRILw&code_challenge_method=S256&response_type=code&scope=openid+profile+email

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',

Also, a very niche need, the callback url is using localhost, which qemu VM is not listening to the localhost, might be better UX if using outbound IP of the VM(?)

@ctjlewis
Copy link
Collaborator

ctjlewis commented Dec 6, 2022

This should actually be fixed in upg latest, at least the failure to open the browser shouldn't throw and exit the process. Try upg update.

You would have to visit the link manually, but you said you can't use localhost?

@ctjlewis
Copy link
Collaborator

ctjlewis commented Dec 6, 2022

If you're on the latest upg and the xdg-open shit is still throwing lmk.

@kaxing
Copy link
Author

kaxing commented Dec 6, 2022

Yeah, I had to use the local IP assigned from the bridge(I think).

Still happening when xdg-open is not in place.

ubuntu@newborn-guinea:~$ upg version


    __  ______  ____ _    UPG CLI 0.1.14
   / / / / __ \/ __ `/    Public Beta
  / /_/ / /_/ / /_/ /
  \__,_/ .___/\__, /      🇺🇸  Built by GPT Labs
      /_/    /____/       The first software to land on the moon!
                          (c) 2022 GPT Labs License

    UPG version: 0.1.14.


ubuntu@newborn-guinea:~$ upg login


    __  ______  ____ _    UPG CLI 0.1.14
   / / / / __ \/ __ `/    Public Beta
  / /_/ / /_/ / /_/ /
  \__,_/ .___/\__, /      🇺🇸  Built by GPT Labs
      /_/    /____/       Used by every NASA engineer!
                          (c) 2022 GPT Labs License


  Attempting to open browser. Please visit this link if it does not open automatically.

  https://gptlabs.us.auth0.com/authorize?client_id=I3rJAbl7D09DuYG6dGeYWtBtpuGyeZrI&redirect_uri=http%3A%2F%2Flocalhost%3A23462&audience=https%3A%2F%2Fgptlabs.us.auth0.com%2Fapi%2Fv2%2F&code_challenge=DI9eCg8Lbh3-Wez0jcj3Lzfh6ZFhpB312Okpnm3XpVI&code_challenge_method=S256&response_type=code&scope=openid+profile+email


node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    'https://gptlabs.us.auth0.com/authorize?client_id=I3rJAbl7D09DuYG6dGeYWtBtpuGyeZrI&redirect_uri=http%3A%2F%2Flocalhost%3A23462&audience=https%3A%2F%2Fgptlabs.us.auth0.com%2Fapi%2Fv2%2F&code_challenge=DI9eCg8Lbh3-Wez0jcj3Lzfh6ZFhpB312Okpnm3XpVI&code_challenge_method=S256&response_type=code&scope=openid+profile+email'
  ]
}

Node.js v18.12.1
ubuntu@newborn-guinea:~$

@cyborgmarina
Copy link
Contributor

Does this issue still matter with the new upg authorize command? Or is it something else we can address?

@kaxing
Copy link
Author

kaxing commented Mar 27, 2023

@marinacabrera Yes, still happen with upg authorize

$ npm -g list
/usr/lib
├── @gptlabs/[email protected]
├── @gptlabs/[email protected]
├── [email protected]
└── [email protected]

$ upg authorize


    __  ______  ____ _    UPG CLI 0.1.14
   / / / / __ \/ __ `/    Public Beta
  / /_/ / /_/ / /_/ /
  \__,_/ .___/\__, /      🇺🇸  Built by GPT Labs
      /_/    /____/       Google HATES us for this ONE WEIRD TRICK!
                          (c) 2022 GPT Labs License

✔ Do you already have an authorization code, or would you like to generate one? › Generate Code

  Attempting to open browser. Please visit this link if it does not open automatically.

  https://gptlabs.us.auth0.com/authorize?client_id=I3rJAbl7D09DuYG6dGeYWtBtpuGyeZrI&redirect_uri=http%3A%2F%2Flocalhost%3A23462&audience=https%3A%2F%2Fgptlabs.us.auth0.com%2Fapi%2Fv2%2F&code_challenge=Wf5z1Rw1F_VlD_J3h3oEjn9B6tGvWlc4rWaZL6TKc3fAl&code_challenge_method=S256&response_type=code&scope=openid+profile+email


node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',

Not certain which component in upg is requiring xdg-open;
Here is an unsafe detour for not wanting to install xdg-utils:

sudo sh -c 'echo "/usr/bin/true" > /usr/bin/xdg-open; chmod +x /usr/bin/xdg-open'

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

3 participants