Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Error in GA authentication #28

Open
E3V3A opened this issue Mar 17, 2018 · 5 comments
Open

Error in GA authentication #28

E3V3A opened this issue Mar 17, 2018 · 5 comments
Labels
bug Confirmed bug help wanted

Comments

@E3V3A
Copy link
Collaborator

E3V3A commented Mar 17, 2018

When running the google-auth.sh script, it spits out an error before you have a chance to enter anything. However, it still runs and gives the token you need.

$ node google-auth.js

Attempted to automatically open the URL, but if it failed, copy/paste this in your browser:
<url shown here>
Paste your code: 
(node:3869) UnhandledPromiseRejectionWarning: Error: Exited with code 3
    at ChildProcess.cp.once.code (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/opn/index.js:84:13)
    at Object.onceWrapper (events.js:272:13)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:180:13)
    at Pipe._handle.close [as _onclose] (net.js:538:12)

(node:3869) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 
This error originated either by throwing inside of an async function without a catch block, 
or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:3869) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. 
In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

<pasted-code-here>
Google Authentication is finished. Press Ctrl+C for quit.
^C

It seem to be a problem in the opn library, so I filed an issue there.

@eouia
Copy link
Owner

eouia commented Mar 20, 2018

That is not errors, just warnings for deprecating futures.
Anyway I wish I get a time or interests for fixing it. :(

@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 21, 2018

@eouia The first message is an error: (node:3869) UnhandledPromiseRejectionWarning: Error: Exited with code 3, meaning that even the rejection warning errored out!

@dev-z
Copy link

dev-z commented Apr 20, 2018

@E3V3A It maybe because of unhandled promise in this file:
MMM-Assistant/node_modules/google-assistant/components/auth.js Line 47

opn(url)

As you see opn(url) returns a promise but has not been handled. Hence the warning.
Can you please replace this line with the one below and try it out?

opn(url).catch((error) => {});

Let me know

@E3V3A
Copy link
Collaborator Author

E3V3A commented Apr 22, 2018

@dev-z Hi! Thank you so much for trying to help. Unfortunately I have broken my RPi from a shitty Kernel update, so I need fix that first before I can run the test. BTW. You also posted this:

opn(uri).then((res) => {
    console.info(res);
}, (err) => {
    console.error(err);
});

What would be the difference?

@dev-z
Copy link

dev-z commented Apr 23, 2018

@E3V3A The difference is that in case of

opn(url).catch((error) => {});

I am just concerned about the error handling. I do not handle the success scenario; whereas, in case of

opn(uri).then((res) => {
    console.info(res);
}, (err) => {
    console.error(err);
});

I am logging the success response as well as the error. Use the former if you are not concerned about the success scenario.

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

No branches or pull requests

3 participants