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

Google sheets API error? #228

Open
timstallmann opened this issue Mar 13, 2020 · 8 comments · May be fixed by #229
Open

Google sheets API error? #228

timstallmann opened this issue Mar 13, 2020 · 8 comments · May be fixed by #229

Comments

@timstallmann
Copy link
Contributor

Config / CLI options

When trying to upload results to Google Sheets, I get that the API returned an error -- google.sheets is not a function. Is this related to maybe updates in the sheets API?

Steps to reproduce.

Stack trace

Screenshot

The API returned an error: TypeError: google.sheets is not a function
Error: TypeError: google.sheets is not a function
    at Object.appendResults (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/sheets/gsheets.js:51:15)
    at Sheets.appendResultsToGSheets (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/sheets/index.js:61:27)
    at async PWMetrics.start (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/index.js:77:17)

Environment

  1. pwmetrics version: 4.2.3
  2. Chrome version:
  3. OS version:
@csb324
Copy link

csb324 commented Mar 17, 2020

I got the same error. If you go to gsheets.js and change
const google = require('googleapis');
to
const { google } = require('googleapis');

...it solves this problem, but then I run into a bunch of other problems (related to OAuth and callbacks not being defined and google's various packages not interacting with each other the way they're supposed to) which may or may not even be related. So, you can try this! But no promises it'll work, because it's not working for me haha

@csb324 csb324 linked a pull request Mar 18, 2020 that will close this issue
@csb324
Copy link

csb324 commented Mar 18, 2020

Update! @timstallmann I just added a PR with the google npm package updates that solved this for me. take a look if you're still trying to get this working

@timstallmann
Copy link
Contributor Author

@csb324 🌠 🎆 this is the best news I've gotten all day! I think the linter is just choking on the async keyword in line 98 of sheets.js.

@timstallmann
Copy link
Contributor Author

Hmm I'm still getting now an invalid grant API response. @csb324 were you able to get this to work all the way through with an actual google sheet upload? I'm wondering if it's a problem on my end..

@nathanmillar16
Copy link

Hi @timstallmann & @csb324 . Did this issue get resolved? I cloned the work done in @csb324 PR, recompiled the TS and I am getting error:

The API returned an error: Error: Unable to parse range: pwmetrics for demo!A1:C1 Error: Error: Unable to parse range: pwmetrics for demo!A1:C1 at GSheets.appendResults in \lib\sheets\gsheets.js\

@nathanmillar16
Copy link

I apologise. I had the wrong config

@timstallmann
Copy link
Contributor Author

Oh nice! @nathanmillar16 how did you fix your config? I'm still stuck on this error.

@nathanmillar16
Copy link

Sorry for late reply. I had the table name in my package-config incorrect. It is supposed to match a tab within the sheets you're adding too.

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

Successfully merging a pull request may close this issue.

3 participants