danthareja / node-google-apps-script

[DEPRECATED - use clasp instead] The easiest way to develop Google Apps Script projects
MIT License
353 stars 70 forks source link

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

Open AledLewis opened 7 years ago

AledLewis commented 7 years ago

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 commented 7 years ago

Happy to write and submit a PR.

lricoy commented 6 years ago

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

AledLewis commented 6 years ago

(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