"OAuth2Client is not a constructor" for google-sheet-sync
See original GitHub issueI am receiving the following error when attempting to deploy the google-sheet-sync function:
TypeError: OAuth2Client is not a constructor
The error points to line 45 in the index file:
const functionsOauthClient = new OAuth2Client(CONFIG_CLIENT_ID, CONFIG_CLIENT_SECRET, FUNCTIONS_REDIRECT);
I go through the 14 steps laid out exactly, configuring all the IDs and everything else. I believe the issue might also have to do with line 22 in the index file:
const {OAuth2Client} = require('google-auth-library');
Elsewhere (e.g. on stack overflow here and on Google’s GitHub here) people have talked about how the syntax for the OAuth2Client class and the GoogleAuth class was altered slightly, but this code reflects that change and this issue remains.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
googleAuth is not a constructor, google-api version problem
For newer versions, you need to use the OAuth2Client property which you can get with destructuring. Other common properties are auth or JWT ......
Read more >Missing function in google sheets API leading to error : r/node
GoogleAuth is not a constructor". despite GoogleAuth being explicitly listed in the documentation. For final reference, yes, ...
Read more >Const authClient = new auth.OAuthClient TypeError
Const authClient = new auth.OAuthClient TypeError: auth.OAuthClient is not a constructor ... Hi, Good spotting, thanks for reporting it. The new ...
Read more >Node.js quickstart | Google Sheets
Quickstarts explain how to set up and run an app that calls a Google Workspace API. Google Workspace quickstarts use the API client...
Read more >“GoogleSpreadsheet is not a constructor” — How to solve ...
Did you come across this error — “GoogleSpreadsheet is not a constructor”, while connecting nodeJS to google spreadsheets?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See #341. 😉
Thanks for getting back to me!
I was using Node version 8.9.4, but I tried updating to 9.6.1 and the issue persisted. I also tried removing the “new” keyword, and the error changed to:
so I do not believe that is the issue. Any other suggestions/ideas?
Thanks!