googleapis/nodejs-googleapis-common

GoogleApis options rootUrl is never used

Closed this issue · 6 comments

Environment details

  • OS: any
  • Node.js version: ^12
  • npm version: ^6
  • googleapis-common version: 5.0.0

Steps to reproduce

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

const google = new GoogleApis({
  rootUrl: 'https://googleapis-endpoint'
});

// gmail API is used for example, it should happen to others as they share createAPIRequest()
const gmail = google.gmail('v1');

// Here it is still using default https://gmail.googleapis.com
gmail.users.history.list({ userId: 'me' });

Greetings! This isn't the way you set global options :) This is covered in the documentation here:
https://github.com/googleapis/google-api-nodejs-client#request-options

Does this currently work for you?

const {google} = require('googleapis');
google.options({
  rootUrl: 'https://googleapis-endpoint',
});

@JustinBeckwith The type definition here says it can use new

nevertheless constructor is using the same options() here, which is also not working.

The actual cause is not where the option is set, is how it is used, please see my PR #356

Heh, the code was running ahead of the docs 😆 Thanks for the pointer!

Closing this for now as we are not looking to support global setting of rootUrl.