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

adsense & adsensehost fail with "Unable to load endpoint adsensehost("v2"): ctr is not a constructor" #1803

Closed
madc0w opened this issue Aug 28, 2019 · 3 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@madc0w
Copy link

madc0w commented Aug 28, 2019

Looking everywhere for some docs on how to use googleapis with adsense and/or adsensehost (not sure what the difference is... where is this explained?)

Doing this:

const { google } = require('googleapis');


const adsense = google.adsensehost({
	version: 'v2',  // tried v3, v1... same effect
	auth: 'api key here'
});

results in:

 ERROR  Unable to load endpoint adsensehost("v1"): ctr is not a constructor                                   16:14:54

  Error: Unable to load endpoint adsensehost("v1"): ctr is not a constructor
  at Object.getAPI (node_modules\googleapis-common\build\src\apiIndex.js:36:15)
  at GoogleApis.adsensehost (node_modules\googleapis\build\src\apis\adsensehost\index.js:22:32)
  at Object.<anonymous> (api\server.js:16:24)
  at Generator.next (<anonymous>)

Unsure where to go from here.

@bcoe bcoe added the type: question Request for information or clarification. Not an issue. label Aug 28, 2019
@bcoe
Copy link
Contributor

bcoe commented Aug 28, 2019

@madc0w try version 4.1, this appears to be the version of this API that we're shipping.

@madc0w
Copy link
Author

madc0w commented Aug 28, 2019

Oh! You meant the version of adsensehost, not the googleapis version. Great, so now this works fine:

const adsense = google.adsensehost({
	version: 'v4.1',
	auth: 'api key'
});

but... this still crashes in the same manner as before:

const adsense = google.adsense({
	version: 'v4.1',
	auth: 'api key'
});

Can you please tell me what is the proper version of adsense I should be using?

@bcoe
Copy link
Contributor

bcoe commented Aug 30, 2019

👋 I know it's clear as mud, but you can find the version for each API in the corresponding src/apis directory:

https://github.com/googleapis/google-api-nodejs-client/tree/master/src/apis/adsense

Adsense in this case is v1.4, I hope this gets you on your feet 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants