dhleong / playactor

play around with your playstation devices
143 stars 13 forks source link

TypeError: Cannot read property 'removeAllListeners' of null #19

Closed dwffls closed 3 years ago

dwffls commented 3 years ago

Hi there,

Love what you're making here, and thinking of porting it to home assistant when I get it working.

However I get the following error when running any command: TypeError: Cannot read property 'removeAllListeners' of null at /usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:125:16 at Generator.next (<anonymous>) at fulfilled (/usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:94:5)

I believe something went wrong in the pairing process, is there a way to delete the previously made connection? Because I get the same error when running the login command, which I did not get running the command the first time.

dhleong commented 3 years ago

Thanks for the report! Seems like the session socket is unexpectedly not initializing, which would track with your belief that the pairing process barfed.

I’ll look into why we’re not handling the error more gracefully, but to answer your specific question—credential data is stored in the $HOME/.config/playactor directory. You should be able to just delete the JSON file in there and try again.

At some point I’ll add a --register flag, or perhaps an explicit setup command, so you don’t have to delete that by hand every time….

On Apr 5, 2021 at 2:11:56 PM, Daan Wijffels @.***> wrote:

Hi there,

Love what you're making here, and thinking of porting it to home assistant when I get it working.

However I get the following error when running any command: TypeError: Cannot read property 'removeAllListeners' of null at /usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:125:16 at Generator.next () at fulfilled (/usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:94:5)

I believe something went wrong in the pairing process, is there a way to delete the previously made connection? Because I get the same error when running the login command, which I did not get running the command the first time.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dhleong/playactor/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGHIFQA5IAEKDRW64UXGY3THH4OZANCNFSM42NG5VPQ .

dwffls commented 3 years ago

Thanks for the quick answer!

Removed the directory, tried login in (this worked) but got the same error.

In a moment, we will attempt to open a browser window with the following URL: https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize?service_entity=urn:service-entity:psn&response_type=code&client_id=ba495a24-818c-472b-b12d-ff231c1b5745&redirect_uri=https://remoteplay.dl.playstation.net/remoteplay/redirect&scope=psn:clientapp&request_locale=en_US&ui=pr&service_logo=ps&layout_type=popup&smcid=remoteplay&prompt=always&PlatformPrivacyWs1=minimal& 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 URL> https://remoteplay.dl.playstation.net/remoteplay/redirect?code=my_code&cid=my_cid Registering via Remote Play. Go to Settings > System > Remote Play > Link Device Enter PIN here> my_pin

TypeError: Cannot read property 'removeAllListeners' of null at /usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:125:16 at Generator.next (<anonymous>) at fulfilled (/usr/local/lib/node_modules/playactor/dist/remoteplay/session.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:94:5)

dwffls commented 3 years ago

I just saw I got this error on an earlier attempt:

Error: Registration error: 403: Forbidden: Other Error at Object.<anonymous> (/usr/local/lib/node_modules/playactor/dist/remoteplay/protocol.js:87:19) at Generator.next (<anonymous>) at fulfilled (/usr/local/lib/node_modules/playactor/dist/remoteplay/protocol.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:94:5)

Don't know if it's helpful

peskdale commented 3 years ago

I am regularly getting the same removeAllListeners error, despite also regenerating my credentials JSON file.

Absolutely unsure if these are related at all... but along with these errors, I'm also having a lot of trouble getting commands other than wake to work properly at all. Most of the time, either a removeAllListeners error appears, or the command just hangs until I exit with Ctrl-C.

On the rare occasions a command exits successfully, the actual function doesn't appear to work as intended. login only seems to perform an actual login in the device is already awake. Otherwise, it only wakes the console and then either errors or hangs.

standby does nothing other than occasionally triggering a remote play notification on the console (and this is inconsistent). Otherwise, again either errors or hangs.

dhleong commented 3 years ago

Strange, I cannot seem to replicate the removeAllListeners error; what version of nodeJS are you all using?

dwffls commented 3 years ago

I'm using node v15.14.0 on macOS 11.2.3.

Tried to run it on my debian server to see if it's a macOS problem. But I got this error:

URL> node:events:346
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:81:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    'https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize?service_entity=urn:service-entity:psn&response_type=code&client_id=ba495a24-818c-472b-b12d-ff231c1b5745&redirect_uri=https://remoteplay.dl.playstation.net/remoteplay/redirect&scope=psn:clientapp&request_locale=en_US&ui=pr&service_logo=ps&layout_type=popup&smcid=remoteplay&prompt=always&PlatformPrivacyWs1=minimal&'
  ]
}

I believe it has something to do with opening the browser

dhleong commented 3 years ago

I'm using node v15.14.0 on macOS 11.2.3.

Thanks! I can reproduce it on believe I have a fix. I'll be rolling on 0.2.1 shortly.