fern icon indicating copy to clipboard operation
fern copied to clipboard

[Bug] `fern login` throwing exception on Ubuntu 22.04.3

Open charliettaylor opened this issue 2 years ago • 5 comments

Describe the bug I attempted to run fern init on my development server and had an exception thrown when it asked me to login

To Reproduce Steps to reproduce the behavior:

  1. SSH into an Ubuntu 22.04.3 server
  2. Run fern login

Expected behavior Normal login behavior should proceed

Screenshots

➜  fern login
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484: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:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    'https://fern-prod.us.auth0.com/authorize?client_id=syaWnk6SjNoo5xBf1omfvziU3q7085lh&response_type=code&connection=github&scope=openid+profile+email+offline_access&redirect_uri=http%3A%2F%2Flocalhost%3A3129&audience=venus-prod'
  ]
}

Node.js v20.9.0

Installing xdg-utils onto my system does not resolve the issue, as now fern login hangs forever. Also, users in headless environments should still be able to login without needing desktop utils.

Desktop:

  • OS: Ubuntu 22.04.3
  • Node: 20.9.0
  • Browser: N/A
  • Version: 0.14.3

charliettaylor avatar Nov 16 '23 07:11 charliettaylor

Hey @charliettaylor this issue hasn't been reported by any other customers and thus isn't a priority for us right now. If this is still preventing you from using Fern, let me know!

dannysheridan avatar Jan 24 '24 04:01 dannysheridan

@dannysheridan Online development environments like GitHub codespaces, GitPod.io, etc will throw this error, could Fern echo the opening URL to console for accessing manually? Just like npm login or vercel login?

It's so important for those users who has a bad Internet connection locally, we can use GitPod-like IDE normally, but disconnected from local CLI:

$ fern init --openapi http://localhost:8080/docs/spec
Failed.
Request timed out  // This isn't my `localhost`, it's `fern login`...

TechQuery avatar Sep 12 '24 11:09 TechQuery

@TechQuery I've reopened this issue based on your feedback. Interested in contributing this change?


Join the Slack Community

dannysheridan avatar Sep 12 '24 15:09 dannysheridan

@dannysheridan I would be down to take a look at it, seems like the issue is using the npm open package to automatically open the URL in browser. We could wrap those calls in a try-catch and log the URL when an exception is thrown, I'm not sure if there is a way to detect if someone is in a headless env, would be nice to do that instead of having to catch an exception.

charliettaylor avatar Sep 13 '24 01:09 charliettaylor

@charliettaylor sounds great. Feel free to post in our Slack community if you have questions while making this contribution.

dannysheridan avatar Sep 13 '24 15:09 dannysheridan

closing as stale, please re-engage if this issue impacts you!

dannysheridan avatar Nov 24 '24 20:11 dannysheridan