-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Environment details
- OS: OSX locally, (Firebase) Cloud Functions cloud-based,
- Node.js version: v10 & v14
- npm version: 6.14.8
googleapisversion: 71.0.0
Steps to reproduce
Node's "searchconsole.urlTestingTools.mobileFriendlyTest.run()" API is throwing "GaxiosError: Request contains an invalid argument." We are using the API via a (Firebase) Cloud Function (both Node v10 nor Node 14 have the same result):
GaxiosError: Request contains an invalid argument.
at Gaxios._request (/workspace/node_modules/gaxios/build/src/gaxios.js:84:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Compute.requestAsync (/workspace/node_modules/googleapis-common/node_modules/google-auth-library/build/src/auth/oauth2client.js:343:18)
at async Object.exports.mobileFriendlyTestTool (/workspace/dist/util/google/searchConsole.js:32:24)
at async /workspace/dist/domainReport/google/integration.js:15:9
at async Promise.all (index 2)
Our code exactly matches https://github.com/googleapis/google-api-nodejs-client/blob/master/src/apis/searchconsole/v1.ts#L1693 with the only difference being that we're using TypeScript (so the import is:
import { google } from 'googleapis';
).
The following will fail:
const res = await searchconsole.urlTestingTools.mobileFriendlyTest.run({
requestBody: {
"requestScreenshot": false,
"url": "https://somedomain.com"
},
});
But replacing it with:
const result = await searchConsoleAPI.sites.list({});
and adding in the necessary scope does not produce an error (i.e. I don't think that this is a permission problem especially since we also use other Google API's such as Sheets without any problems).