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

playactor login (registration) with PS5: Unhandled 'error' event #23

Closed
LordZork opened this issue Apr 12, 2021 · 13 comments
Closed

playactor login (registration) with PS5: Unhandled 'error' event #23

LordZork opened this issue Apr 12, 2021 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@LordZork
Copy link

LordZork commented Apr 12, 2021

This is actually similar to what @dwffls most recently experienced/mentioned shortly before you closed #19.

I have not encountered the removeAllListeners error that was also mentioned, only the error below... which I have experienced with both playactor 0.2.0 and playactor 0.2.1.

Notes:

USAGE/SETUP

  1. Using Homebridge on a Raspberry Pi, flashed to an SD card – i.e., no OS on the Pi, other than Homebridge, which uses Raspbian GNU/Linux Buster (10).

  2. Using node.js v14.16.1 and npm v7.9.0.

  3. Using Homebridge UI (homebridge-config-ui-x v4.41.0) via the web interface homebridge.local/ – via Google Chrome – from my Mac (macOS 10.15.7), to connect to/manage Homebridge and related plugins, and to run Homebridge Terminal installs, commands, etc. (which are all running on the Pi).

ATTEMPTS/RESULTS

  1. When I attempt playactor login in Homebridge Terminal (where playactor is operating), it returns:
    In a moment, we will attempt to open a browser window with the following URL:
    <url>
    Perform login there, then, when the page shows "redirect", copy the URL from your browser's address bar and paste it here.
    Hit ENTER to continue

  2. Based on my usage/setup (I'm guessing), the provided <url> doesn't auto-open. I have to click on the <url> link, which then opens in a new browser window/tab on my Mac (OUTSIDE of where playactor is operating).

  3. After clicking on/opening the provided <url> and logging in, I copy/paste the "redirect" URL – into Homebridge Terminal (where playactor is operating) in the homebridge.local/ browser window/tab – and then "Hit ENTER to continue".

  4. The result is the following error(s), which is what @dwffls most recently experienced/mentioned...

ERROR(S)

URL> events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    '<url>'
  ]
}

@dhleong, per your request from ps4-waker#150, I will continue any setup-specific discussions (i.e., using playactor with Homebridge) here: discussion #22.

@aclerok, would you view discussion #22 and – if possible – explain your playactor and Homebridge setup/steps, and any other related setup/steps, as well as the steps you used to resolve your login issue(s)? Thanks!

@dhleong
Copy link
Owner

dhleong commented Apr 13, 2021

Wow, thanks for the very detailed issue report!

Should be easy enough to handle but in the meantime a simple workaround is to do the setup on your Mac and copy the credentials file over to the device. Credentials are stored at ~/.config/playactor

@dhleong
Copy link
Owner

dhleong commented Apr 13, 2021

Also, to provide a little more detail: it's waiting to open the URL until you hit enter; you see the error after you paste and hit enter because that's what triggers it to try (and fail) to open the URL.

@LordZork
Copy link
Author

Wow, thanks for the very detailed issue report!

Should be easy enough to handle but in the meantime a simple workaround is to do the setup on your Mac and copy the credentials file over to the device. Credentials are stored at ~/.config/playactor

@dhleong, I apologize for being such a noob here, but could you provide a bit more detail regarding the workaround?

  1. How do I do the setup on my Mac? What do I use, etc.?
  2. How do I copy the credentials file over to the device?

The device is my Raspberry Pi, which is not running an OS with a file (folder) system (that I know of)... just Homebridge (with Homebridge UI – via the web interface homebridge.local/ – and Homebridge Terminal), which is flashed to the SD card.

I am not sure how I would access or copy the credentials file over to the device. Would this all be done via Terminal?

Also, when you say this "should be easy enough to handle," does that mean you should be able to update playactor so a workaround, in this scenario, won't be necessary? I'm just curious, in case I'm unable to figure out the workaround, lol.

Thanks again for all your playactor work/effort, and for your help here!

@aclerok, I am starting to think you ran into a similar issue and had to implement a workaround as well. Would you be able to provide more detail? Thanks!

@dhleong
Copy link
Owner

dhleong commented Apr 13, 2021 via email

@aclerok
Copy link

aclerok commented Apr 13, 2021

What I found in my install was this: you are running the playactor login from a different user than Homebridge is actually running on the raspberry pi. I had to use VNC and get logged in as the same user that my homebridge service was running as, and then issue the playactor login command there and complete the process as documented. This created the .config/playactor directory and files underneath the correct user, and it began working.

What @dhleong is mentioning above with copying your folder is essentially doing the same thing. In practice might be easier than my method, as there were multiple steps to get the homebridge user the correct permissions, etc.

@LordZork
Copy link
Author

@dhleong, thanks!! I may wait for the update, though, as I'm still not sure I fully understand the workaround... and I'm not sure I want to try, especially knowing that an update/fix is imminent.

@aclerok, thanks for the info! Though, I'm not sure I understand why your setup was/is running from a different user than the Homebridge service.

How is your Homebridge setup? It sounds like you have an OS installed on your Raspberry Pi, and then you installed Homebridge within that OS? If so, does that mean you used VNC to remote into the OS installed on the Pi, and then manage Homebridge from there?

For my setup, since I don't have an OS installed on my Pi (and thus don't have Homebridge installed within an OS), I have to manage Homebridge externally (from a different computer), via the web interface homebridge.local/. As such, I'm guessing there is nothing for me to VNC into.

I'm wondering if my issue is "user" related, like yours was... or if my issue is different? Were you getting the same error as me?

@dhleong dhleong self-assigned this Apr 14, 2021
@dhleong dhleong added the bug Something isn't working label Apr 14, 2021
@aclerok
Copy link

aclerok commented Apr 14, 2021

@LordZork

It sounds like you have an OS installed on your Raspberry Pi, and then you installed Homebridge within that OS? If so, does that mean you used VNC to remote into the OS installed on the Pi, and then manage Homebridge from there?

Yes, this is my scenario exactly. I'm not sure exactly how the web based console works in your setup. Essentially I consoled in to my Pi as User1 and the homebridge software was running as User2. Since I ran the playactor login as User1, User2 didn't have the credentials available to it.

@LordZork
Copy link
Author

@dhleong I installed the latest playactor update (0.2.2), but I'm still running into the same issue. The only difference is that now it only shows the URL (that it wants to auto-open) after I hit enter.

I've tried hitting enter without pasting the "redirect," and I've tried pasting the "redirect" and then hitting enter. Both ways result in the same error as before (shown below).

Why can't I just paste the "redirect" and hit enter? How is this supposed to work? It's unclear as I feel like I am following the instructions but can't get past this registration process and resulting error.

The only thing I can think of is that, due to my setup, the auto-open URL thing is the hangup. Is it possible to remove the need to auto-open the URL and just let people click on the link, and then paste the "redirect" and hit enter?

I use ps4-waker (with the same Homebridge setup) without any issues, so it must be possible.

Attempt/errors

pi@homebridge:/var/lib/homebridge $ playactor login

In a moment, we will attempt to open a browser window for you to login to your PSN account.
When the page shows "redirect", copy the URL from your browser's address bar and paste it here.
Hit ENTER to continue
URL> events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    '<url>'
  ]
}

@dhleong
Copy link
Owner

dhleong commented Apr 14, 2021 via email

@LordZork
Copy link
Author

@dhleong sounds good, thanks again for all your work on this!

@dhleong
Copy link
Owner

dhleong commented Apr 15, 2021

Check out v0.2.3; hopefully this will catch that error more gracefully!

@dhleong dhleong reopened this Apr 15, 2021
@LordZork
Copy link
Author

@dhleong, perfect—that did the trick! Thanks!!!

@dhleong dhleong closed this as completed Apr 16, 2021
@tommyMX
Copy link

tommyMX commented Jan 12, 2022

Hi,

i have the playactor on a Synology NAS running in a docker. How can I fix this with the open browser problem?

Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants