Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Cannot read property 'access token' of undefined #150

Closed
elserge82 opened this issue Jan 7, 2020 · 19 comments
Closed

Cannot read property 'access token' of undefined #150

elserge82 opened this issue Jan 7, 2020 · 19 comments

Comments

@elserge82
Copy link

elserge82 commented Jan 7, 2020

The first time I installed your plugin. I created a new user and everything was successful.Few days later the plugin stopped with the following error:
getting metadata from plugin failed with error: Cannot read property 'access token' of undefined.
I added a new user and everything went fine. Few days later , the plugin no longer working with the same error. Not sure what caused it but whenever I need a relay command it ended unsuccessful. :)

My platform consist of Hassio docker on Raspbian.
Thank you. And hopefully with your help I can sort this out .

@elserge82 elserge82 reopened this Jan 7, 2020
@ryancasler
Copy link
Contributor

Are you running GAR inside of docker as well? Or on the native raspbian OS?

@Apipa169
Copy link
Contributor

Apipa169 commented Jan 7, 2020

He is using my Hassio addon. But I don’t think this is related to the addon as it is just an image with GAR pre installed.

@greghesp
Copy link
Owner

greghesp commented Jan 9, 2020

Grr, not this again. It's such a sporadic and random issue, it's nearly impossible to figure out what's causing it.

I have a suspicion it depends on the JSON file you downloaded. Which one did you download from the console?

@ryancasler
Copy link
Contributor

Could it be browser related when uploading the file?

@greghesp
Copy link
Owner

Don't think so as it'll work fine for a few days and then randomly stop

@ryancasler
Copy link
Contributor

If this is in a docker image, are you trying to expose that folder to the host OS as well? You could have problem if the host and GAR are trying to access the file simultaneously. I don't know how the plug-in is running the docker image and if the filepath is synced to the host OS.

@Apipa169
Copy link
Contributor

The config file is mounted to the host of course, like nearly every docker set up.

I don’t think this is the cause of this problem.

@elserge82 are you able to send the complete log of the addon when it fails?

@elserge82
Copy link
Author

The config file is mounted to the host of course, like nearly every docker set up.

I don’t think this is the cause of this problem.

@elserge82 are you able to send the complete log of the addon when it fails?

If you tell me your exact request( I have many logs don't know what you're referring to), I'm ready to do so.

@Apipa169
Copy link
Contributor

Can you go to the addon in hassio, restart the addon, wait till it’s running again and send a broadcast command.

Could you then copy the complete log on the addon page?

@elserge82
Copy link
Author

`Assistant Relay is now starting...

assistant-relay@3.1.4 start /assistant_relay
pm2 start ./bin/www && pm2 log www

                    -------------

/\\\\\\_/\\/\\/\\\\_
_/\/////////\_/\\\
/\\\/\///////\_
/\_
/\_/\//\_/\//\_/////\_
_/\\\\\\/
/\\///\/\/
/\_
/\/
/\/////////
/\_
///\/
/\_/\//_____
/\_
/\_////\_____/\//_____
/\_/\_/\_/\/__________
/\_/\_/\_/\\\\\\\_
_////////////////////////

                      Runtime Edition

    PM2 is a Production Process Manager for Node.js applications
                 with a built-in Load Balancer.

            Start and Daemonize any application:
            $ pm2 start app.js

            Load Balance 4 instances of api.js:
            $ pm2 start api.js -i 4

            Monitor in production:
            $ pm2 monitor

            Make pm2 auto-boot at server restart:
            $ pm2 startup

            To go further checkout:
            http://pm2.io/


                    -------------

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /assistant_relay/bin/www in fork_mode (1 instance)
[PM2] Done.
┌─────┬──────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼──────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ www │ default │ 3.1.4 │ fork │ 50 │ 0s │ 0 │ online │ 0% │ 22.0mb │ root │ disabled │
└─────┴──────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[TAILING] Tailing last 15 lines for [www] process (change the value with --lines option)
/root/.pm2/logs/www-out.log last 15 lines:
/root/.pm2/logs/www-error.log last 15 lines:
0|www | Assistant Relay Server Initialized
0|www | Visit http://172.30.33.1:3000 in a browser to configure
0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined
0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined
0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15)
0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26)
0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8)
0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15)
0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42)
0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8)
0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 {
0|www | code: 14,
0|www | metadata: Metadata { _internal_repr: {}, flags: 0 },
0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined"
0|www | }`

@elserge82
Copy link
Author

0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Assistant Relay Server Initialized 0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Assistant Relay Server Initialized 0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Assistant Relay Server Initialized 0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Assistant Relay Server Initialized 0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Assistant Relay Server Initialized 0|www | Visit http://172.30.33.1:3000 in a browser to configure 0|www | Auth error:TypeError: Cannot read property 'access_token' of undefined 0|www | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined 0|www | at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15) 0|www | at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26) 0|www | at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8) 0|www | at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15) 0|www | at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42) 0|www | at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8) 0|www | at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 { 0|www | code: 14, 0|www | metadata: Metadata { _internal_repr: {}, flags: 0 }, 0|www | details: "Getting metadata from plugin failed with error: Cannot read property 'access_token' of undefined" 0|www | } 0|www | Error: Status code 429 0|www | at ClientRequest.<anonymous> (/assistant_relay/node_modules/rss-parser/lib/parser.js:92:25) 0|www | at Object.onceWrapper (events.js:300:26) 0|www | at ClientRequest.emit (events.js:210:5) 0|www | at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:585:27) 0|www | at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17) 0|www | at TLSSocket.socketOnData (_http_client.js:454:22) 0|www | at TLSSocket.emit (events.js:210:5) 0|www | at addChunk (_stream_readable.js:325:12) 0|www | at readableAddChunk (_stream_readable.js:300:11) 0|www | at TLSSocket.Readable.push (_stream_readable.js:234:10)

@ryancasler
Copy link
Contributor

Yeah, the config file is not being recognized. This is a docker problem, not a GAR relay problem.

@elserge82
Copy link
Author

you might be right. the problem occurs on reboot

@ryancasler
Copy link
Contributor

I'd take a closer look at the docker image you're running and see what mappings it has for your config file and why that isn't persistent across executions of the container.

@Apipa169
Copy link
Contributor

@elserge82 Sorry for letting you wait. Do you get errors in the log if you are visiting the settings page? The config file is being loaded as well if you visit this page.

@elserge82
Copy link
Author

elserge82 commented Feb 4, 2020

@elserge82 Sorry for letting you wait. Do you get errors in the log if you are visiting the settings page? The config file is being loaded as well if you visit this page.

I'll check it when I get back home. Thank you guys for your support

@elserge82
Copy link
Author

I updated the addon to the latest version. The settings page wont load .Uninstalled reinstalled the addon everything is back to normal.

@jaytaylor
Copy link

Auth error:TypeError: Cannot read property 'access_token' of undefined

Cannot read property 'converse' of undefined

Following a HomeAssistant / HASSIO Assistant-Relay setup tutorial, I encountered the above errors in the container logs when testing in the AR Sandbox. Resolved by removing and reinstalling the add-on in HASSIO and re-creating / re-authenticating my assistant-relay user.

To me this suggests the culprit is likely that the access_token initialization failed the first time around.

After that, all errors have cleared up and Assistant-Relay is working magnificently!

Related issues:

#150
#126
#242

Hope this can help anyone else who encounters this class of issue in the future.

<3

@partytimeexcellent
Copy link

I encountered the above errors in the container logs when testing in the AR Sandbox. Resolved by removing and reinstalling the add-on in HASSIO and re-creating / re-authenticating my assistant-relay user.

To me this suggests the culprit is likely that the access_token initialization failed the first time around.

Thank you for posting this! It was the same for me and I was going crazy. I think because Safari blocked the Google Signin pop-up. Your solution fixed it. Cheers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants