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

ReferenceError: accessToken is not defined when connecting on some GB sessions #77

Closed
jsiegenthaler opened this issue Nov 17, 2022 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@jsiegenthaler
Copy link
Owner

jsiegenthaler commented Nov 17, 2022

Reported by @robscousins on issue #76

Occurs after a GB session has connected:

[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Status Fault changed from undefined [undefined] to 0 [NO_FAULT]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Status Active changed from undefined [undefined] to 1 [ACTIVE]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: In Use changed from undefined [undefined] to 0 [NOT_IN_USE]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Picture Mode changed from null [OTHER] to 1 [STANDARD]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Program Mode changed from undefined [undefined] to 1 [PROGRAM_SCHEDULED]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Input Device Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 1 [TV]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Input Source Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 2 [TUNER]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Family Room: Recording state: ongoing recordings found: local 0, network 0, current Recording State 0 [IDLE]
[11/17/2022, 4:19:22 PM] [EOSSTB] VM Front Room: Recording state: ongoing recordings found: local 0, network 0, current Recording State 0 [IDLE]

/homebridge/node_modules/homebridge-eosstb/index.js:1627
const config = {headers: {"x-cus": accessToken, "x-oesp-token": this.session.accessToken, "x-oesp-username": this.session.username}};
^
ReferenceError: accessToken is not defined
at stbPlatform.setPersonalizationDataForDevice (/homebridge/node_modules/homebridge-eosstb/index.js:1627:38)
at stbDevice.setDeviceName (/homebridge/node_modules/homebridge-eosstb/index.js:4215:19)
at ConfiguredName. (/homebridge/node_modules/homebridge-eosstb/index.js:3031:45)
at ConfiguredName.emit (node:events:513:28)
at /homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1725:16
at new Promise ()
at ConfiguredName. (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1723:14)
at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
[11/17/2022, 4:19:24 PM] [EOSSTB] Child bridge process ended
[11/17/2022, 4:19:24 PM] [EOSSTB] Process Ended. Code: 1, Signal: null

@robscousins
Copy link

robscousins commented Nov 17, 2022

restarted Child bridge WITHOUT adding individual device to HomeKit - no errors:
[logs snipped]

@robscousins
Copy link

robscousins commented Nov 17, 2022

Now adding accessory in HomeKit (bridge already added) after keying in the setup code and selecting the room:

/homebridge/node_modules/homebridge-eosstb/index.js:1627
const config = {headers: {"x-cus": accessToken, "x-oesp-token": this.session.accessToken, "x-oesp-username": this.session.username}};
^
ReferenceError: accessToken is not defined
at stbPlatform.setPersonalizationDataForDevice (/homebridge/node_modules/homebridge-eosstb/index.js:1627:38)
at stbDevice.setDeviceName (/homebridge/node_modules/homebridge-eosstb/index.js:4215:19)
at ConfiguredName. (/homebridge/node_modules/homebridge-eosstb/index.js:3031:45)
at ConfiguredName.emit (node:events:513:28)
at /homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1725:16
at new Promise ()
at ConfiguredName. (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1723:14)
at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
[11/17/2022, 10:07:31 PM] [EOSSTB] Child bridge process ended
[11/17/2022, 10:07:31 PM] [EOSSTB] Process Ended. Code: 1, Signal: null
[11/17/2022, 10:07:38 PM] [EOSSTB] Restarting Process...

now stuck in a loop until I either stop the (child) bridge or remove the (VM media) accessory)

[11/17/2022, 10:07:58 PM] [EOSSTB] VM Front Room: Input Device Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 1 [TV]
[11/17/2022, 10:07:58 PM] [EOSSTB] VM Front Room: Input Source Type changed on input 0 ID_UNKNOWN from undefined [undefined] to 2 [TUNER]
[11/17/2022, 10:07:58 PM] [EOSSTB] VM Family Room: Recording state: ongoing recordings found: local 0, network 1, current Recording State 1 [ONGOING_NDVR]
[11/17/2022, 10:07:58 PM] [EOSSTB] VM Front Room: Recording state: ongoing recordings found: local 0, network 1, current Recording State 1 [ONGOING_NDVR]

/homebridge/node_modules/homebridge-eosstb/index.js:1627
const config = {headers: {"x-cus": accessToken, "x-oesp-token": this.session.accessToken, "x-oesp-username": this.session.username}};
^
ReferenceError: accessToken is not defined
at stbPlatform.setPersonalizationDataForDevice (/homebridge/node_modules/homebridge-eosstb/index.js:1627:38)
at stbDevice.setDeviceName (/homebridge/node_modules/homebridge-eosstb/index.js:4215:19)
at ConfiguredName. (/homebridge/node_modules/homebridge-eosstb/index.js:3031:45)
at ConfiguredName.emit (node:events:513:28)
at /homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1725:16
at new Promise ()
at ConfiguredName. (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1723:14)
at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
at /homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
[11/17/2022, 10:08:02 PM] [EOSSTB] Child bridge process ended
[11/17/2022, 10:08:02 PM] [EOSSTB] Process Ended. Code: 1, Signal: null

@jsiegenthaler
Copy link
Owner Author

Yes, that's clear. I need full logs in full debugging mode emailed to me. There's an accessToken missing, and I need to see where it goes missing.

@robscousins
Copy link

robscousins commented Nov 17, 2022

note - I am still in the Name TV Inout Sources Screen' and when I finish that, HomeKit finishes the process and one of the two VM boxes IS visible in HomeKit and seems to operating ok:

[logs snipped]

The above is new to me as previously it stuck in an error look but that now appears to have cleared up, however, the other VM box isn't visible in HomeKit

@jsiegenthaler
Copy link
Owner Author

@robscousins Full logs please. But do not post them here, they are too big. Zip them and mail them. I need to see the json responses and all the data related to the session to find why and where the accessToken is lost.

@robscousins
Copy link

yep will do (although I am continue to play. thanks and all the best

@robscousins
Copy link

Ok went to Homebridge settings and went to unpair Bridges/cameras/tv etc option and remove the bridge, and the two VM boxes. Removed child bridge from plug in config. rebooted.

Both accessories appeared and I was able to add them successfully to HomeKit (although it did error a couple of times with the token issue but eventually passed and appears to be working )no further errors observed so far in the last few minutes

Will review tomorrow and/or on child bridge

thanks

@jsiegenthaler
Copy link
Owner Author

@robscousins I do not want to ignore this issue, I need to resolve what the token was missing. So I need full logs sent by email to analyze the issue.

@jsiegenthaler
Copy link
Owner Author

@robscousins any news?

@robscousins
Copy link

robscousins commented Nov 20, 2022 via email

@jsiegenthaler
Copy link
Owner Author

jsiegenthaler commented Nov 26, 2022

Hi @robscousins Found the issue. Fixed in 2.0.2-beta.4 Please try the beta and confirm it is working for you.
Once confirmed I'll publish a release.

PS: I snipped the logs to clean up this thread and remove some potentially sensitive data from public display

@robscousins
Copy link

robscousins commented Nov 26, 2022 via email

@jsiegenthaler
Copy link
Owner Author

jsiegenthaler commented Nov 26, 2022

In Homebridge Plugins: click on the Spanner icon of the plugin, select Install Alternate Version, choose the version you wish to install (in this case v2.0.2-beta.4) from the list of available versions.

You can change to any version at any time, just restart Homebridge after each change.

@robscousins
Copy link

robscousins commented Nov 26, 2022 via email

@jsiegenthaler
Copy link
Owner Author

jsiegenthaler commented Nov 26, 2022

To recreate the circumstances that caused the crash, all you have to do is have EOSSTB Sync Name option checked, and then rename the box using the Home app. If the rename completes successfully (check it on the TV ), and there are no errors in the Homebridge logs, then all is good.

It was a simple bug, I should have spotted it with your first bug report. It is fixed.

@duckduckwd
Copy link

I have had the same accessToken error appearing when I tried to switch the device on/off from the HomeKit app.

After reading this thread, I have installed v2.0.2-beta.9 and can confirm that the issues seen below have been fixed with this code.

[26/11/2022, 14:12:36] ReferenceError: accessToken is not defined
    at stbPlatform.setPersonalizationDataForDevice (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:1584:38)
    at stbDevice.setDeviceName (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:4185:19)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:3001:45)
    at ConfiguredName.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2596:16
    at new Promise (<anonymous>)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2594:14)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
    at ConfiguredName.Characteristic.handleSetRequest (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:871:24)
    at Accessory.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1889:29)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
[26/11/2022, 14:12:36] Got SIGTERM, shutting down Homebridge...
[26/11/2022, 14:12:37] [EOSSTB] Goodbye
[26/11/2022, 14:12:37] [EOSSTB] mqttClient: Connection closed
[26/11/2022, 14:16:58] [EOSSTB] Family Room: In Use changed from 0 [NOT_IN_USE] to 1 [IN_USE]
[26/11/2022, 14:16:58] [EOSSTB] Family Room: Media state changed from 2 [STOP] to 0 [PLAY]
[26/11/2022, 14:19:42] ReferenceError: accessToken is not defined
    at stbPlatform.setPersonalizationDataForDevice (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:1584:38)
    at stbDevice.setDeviceName (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:4185:19)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:3001:45)
    at ConfiguredName.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2596:16
    at new Promise (<anonymous>)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2594:14)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
    at ConfiguredName.Characteristic.handleSetRequest (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:871:24)
    at Accessory.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1889:29)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
[26/11/2022, 14:19:44] [BraviaTVOS] [DEBUG] Living Room TV: Polling API...
[26/11/2022, 14:19:45] ReferenceError: accessToken is not defined
    at stbPlatform.setPersonalizationDataForDevice (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:1584:38)
    at stbDevice.setDeviceName (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:4185:19)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge-eosstb/index.js:3001:45)
    at ConfiguredName.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2596:16
    at new Promise (<anonymous>)
    at ConfiguredName.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2594:14)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
    at ConfiguredName.Characteristic.handleSetRequest (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:871:24)
    at Accessory.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1889:29)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
[26/11/2022, 14:19:45] Got SIGTERM, shutting down Homebridge...
[26/11/2022, 14:19:46] [EOSSTB] Goodbye

When powering off now, the log records a successful operation:

[26/11/2022, 14:37:43] [EOSSTB] sendKey: processing key 1 of 1: Power
[26/11/2022, 14:37:43] [EOSSTB] sendKey: sending key Power to Family Room 3C36E4-EOSSTB-003458068602
[26/11/2022, 14:37:45] [EOSSTB] Family Room: Power changed from 1 [ON] to 0 [OFF]
[26/11/2022, 14:37:45] [EOSSTB] Family Room: In Use changed from 1 [IN_USE] to 0 [NOT_IN_USE]
[26/11/2022, 14:37:45] [EOSSTB] Family Room: Media state changed from 0 [PLAY] to 2 [STOP]

Thanks for your work on this! I look forward to the update being released!

@jsiegenthaler
Copy link
Owner Author

@duckduckwd Thanks for the feedback, I hope to release v2.0.2 in the next few days

@jsiegenthaler
Copy link
Owner Author

Issues resolved in v2.0.2, published just now 28.11.2022

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

3 participants