node-google-apps-script icon indicating copy to clipboard operation
node-google-apps-script copied to clipboard

gapps auth command will fail and not show error if call to Oauth.getToken fails

Open AledLewis opened this issue 7 years ago • 3 comments

Essentially, I think there's a missing else block around the credentials.refresh_token = tokens.refresh_token; resolve(credentials); At auth.js:90. This masks any issues with communicating with Google (in my case there was a proxy issue). I believe this issue occurs in other places in the project (I deleted my auth and re-authed as I was getting errors running upload/push.

AledLewis avatar May 04 '17 14:05 AledLewis

Happy to write and submit a PR.

AledLewis avatar May 04 '17 15:05 AledLewis

Hi @AledLewis PRs are welcome if you could provide more specific steps to reproduce I could try this as well.

lricoy avatar Nov 29 '17 10:11 lricoy

(couldn't reproduce, this is from memory).

Symptom was Uncaught TypeError: Cannot read property 'refresh_token' of undefined

It was some interaction with my proxy on gapps auth that caused getToken to fail. It looks like execution continues to attempt to write to credentials with a probably-undefined tokens object. This then causes the promise to exit and mask the reject (I guess).

Here's a PR to show my fix https://github.com/danthareja/node-google-apps-script/pull/76

AledLewis avatar Nov 30 '17 15:11 AledLewis