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

gapps init causes syntax error if response body is not JSON #40

Open
jacktaylor418 opened this issue Aug 10, 2016 · 1 comment
Open

Comments

@jacktaylor418
Copy link

jacktaylor418 commented Aug 10, 2016

I got a syntax error from the command gapps init 123...xyz (with "123...xyz" substituted by my real project ID). Here's the error:

[jack@mycomputer myproject]$ gapps init 123...xyz
Error parsing project files
Script file ID not found. Please input an ID and try again.
Error running init command
Unhandled rejection SyntaxError: Unexpected token <
    at Object.parse (native)
    at /usr/lib/node_modules/node-google-apps-script/lib/manifestor.js:79:19
    at tryCatcher (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/promise.js:505:31)
    at Promise._settlePromiseAt (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/node-google-apps-script/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

After some digging, I found that JSON.parse in line 79 of manifestor.js was expecting JSON but actually received an HTML page. The HTML page was one saying "You need permission ... Want in? Ask the owner for access, or switch to an account with permission." I think I may have made a mistake when getting my credentials in the Google Developer Console, hence the authentication error.

It would be nice to handle this more elegantly, as the error message is pretty confusing - it makes it seem like the error is something to do with the project ID itself, when it is actually an authentication problem.

@georgeh
Copy link

georgeh commented Nov 17, 2016

I had this issue - I had created my project with the wrong Google account. I fixed it by sharing the project with the correct account.

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

No branches or pull requests

3 participants