pwmetrics icon indicating copy to clipboard operation
pwmetrics copied to clipboard

Google sheets API error?

Open timstallmann opened this issue 5 years ago • 8 comments

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:

timstallmann avatar Mar 13 '20 19:03 timstallmann

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 avatar Mar 17 '20 22:03 csb324

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

csb324 avatar Mar 18 '20 21:03 csb324

@csb324 :stars: :fireworks: 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 avatar Mar 18 '20 22:03 timstallmann

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..

timstallmann avatar Mar 24 '20 20:03 timstallmann

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 avatar Jun 02 '20 15:06 nathanmillar16

I apologise. I had the wrong config

nathanmillar16 avatar Jun 02 '20 16:06 nathanmillar16

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

timstallmann avatar Jun 02 '20 16:06 timstallmann

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.

nathanmillar16 avatar Jun 16 '20 14:06 nathanmillar16