You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ node quickstart.js
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module '/path/to/keys.json'
Require stack:
- /Users/wescpy/node_modules/@google-cloud/local-auth/build/src/index.js
- /Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at authenticate (/Users/wescpy/node_modules/@google-cloud/local-auth/build/src/index.js:45:21)
at quickstart (/Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js:4:27)
at Object.<anonymous> (/Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js:10:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/wescpy/node_modules/@google-cloud/local-auth/build/src/index.js',
'/Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js'
]
}
2b. Run it in the cloud (Cloud Shell)... pretty much the same error:
wescpy@cloudshell:~/cloudshell_open/nodejs-local-auth/samples$ uname -a
Linux cs-807601953565-default-boost-sjpfp 5.4.144+ #1 SMP Sat Sep 25 09:56:01 PDT 2021 x86_64 GNU/Linux
wescpy@cloudshell:~/cloudshell_open/nodejs-local-auth/samples$ node -v
v12.14.1
wescpy@cloudshell:~/cloudshell_open/nodejs-local-auth/samples$ npm -v
7.24.1
wescpy@cloudshell:~/cloudshell_open/nodejs-local-auth/samples$ npm view @google-cloud/local-auth version
1.0.1
wescpy@cloudshell:~/cloudshell_open/nodejs-local-auth/samples$ node quickstart.js
(node:2267) UnhandledPromiseRejectionWarning: Error: Cannot find module '/path/to/keys.json'
Require stack:
- /home/wescpy/cloudshell_open/nodejs-local-auth/samples/node_modules/@google-cloud/local-auth/build/src/index.js
- /home/wescpy/cloudshell_open/nodejs-local-auth/samples/quickstart.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at authenticate (/home/wescpy/cloudshell_open/nodejs-local-auth/samples/node_modules/@google-cloud/local-auth/build/src/index.js:45:21)
at quickstart (/home/wescpy/cloudshell_open/nodejs-local-auth/samples/quickstart.js:19:27)
at Object.<anonymous> (/home/wescpy/cloudshell_open/nodejs-local-auth/samples/quickstart.js:25:1)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
(node:2267) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2267) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Obviously that filepath isn't real, but changing it to client_secret.json, which is a real file, still fails w/the same error.
Just for the heck of it, I added use of the path module, to provide a full path:
$ node quickstart.js
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:552:9)
at new URL (node:internal/url:628:5)
at authenticate (/Users/wescpy/node_modules/@google-cloud/local-auth/build/src/index.js:51:19)
at quickstart (/Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js:5:27)
at Object.<anonymous> (/Users/wescpy/maestro/backup/google-apis/youtube/quickstart.js:11:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
input: 'oob',
code: 'ERR_INVALID_URL'
}
Any help explaining/solving both of these issues will help... thanks!
The text was updated successfully, but these errors were encountered:
path/to/key.json in that sample needs to be replaced with the path to a credential json file (like an exported service account key, or user credentials).
An oauth client_secret.json is probably not a credential file (it's likely an OAuth app client secret file).
Thanks Jeff. So what you're saying is that this library is only for service account public/private keypair credentials JSON files, not OAuth client ID/secret JSON files? I thought that was well and swapped in the former, but this library still crashes because it's looking for redirect_uris which aren't in SA keypair creds files. Is it possible it has to be a web server OAuth client ID? (I was trying it for an installed app rather than for web apps.) Why does this library exist alongside the one you linked to? What's the difference b/w them, e.g., their differing use cases? And should this one be archived?
Environment details
Steps to reproduce
quickstart.js
:2a. Run it (locally):
2b. Run it in the cloud (Cloud Shell)... pretty much the same error:
Obviously that filepath isn't real, but changing it to
client_secret.json
, which is a real file, still fails w/the same error.path
module, to provide a full path:It still fails, but with a different error now:
Any help explaining/solving both of these issues will help... thanks!
The text was updated successfully, but these errors were encountered: