GeezerVison is showing github.com — path.replace is not a function · Issue #1445 · googleapis/google-cloud-node
path.replace is not a function #1445DescriptionHey guys,
So i'm having the same issue as #1389 and i cannot identify why. Here are the logs of the error :
var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
^
TypeError: path.replace is not a function
at Mime.lookup (/Users/devOps/Desktop/_devOps/once-rest/node_modules/mime/mime.js:70:18)
at GoogleToken.getToken (/Users/devOps/Desktop/_devOps/once-rest/node_modules/gtoken/lib/index.js:55:33)
at /Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auth-library/lib/auth/jwtclient.js:137:21
at JWT._createGToken (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auth-library/lib/auth/jwtclient.js:225:12)
at JWT.refreshToken_ (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auth-library/lib/auth/jwtclient.js:133:15)
at JWT.OAuth2Client.refreshAccessToken (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auth-library/lib/auth/oauth2client.js:203:8)
at JWT.OAuth2Client.getAccessToken (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auth-library/lib/auth/oauth2client.js:237:10)
at /Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auto-auth/index.js:118:12
at addScope (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auto-auth/index.js:74:5)
at Auth.getAuthClient (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auto-auth/index.js:49:5)
at Auth.getToken (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auto-auth/index.js:112:8)
at Auth.authorizeRequest (/Users/devOps/Desktop/_devOps/once-rest/node_modules/google-auto-auth/index.js:16:8)
at Storage.makeAuthenticatedRequest (/Users/devOps/Desktop/_devOps/once-rest/node_modules/gcloud/lib/common/util.js:371:18)
at Storage.Service.request (/Users/devOps/Desktop/_devOps/once-rest/node_modules/gcloud/lib/common/service.js:117:15)
at Storage.getBuckets (/Users/devOps/Desktop/_devOps/once-rest/node_modules/gcloud/lib/storage/index.js:399:8)
at makeRequest (/Users/devOps/Desktop/_devOps/once-rest/node_modules/gcloud/lib/common/stream-router.js:202:5)
Environment details
- OS: OS X El Capitan
- Node.js version: 6.2.1
- npm version: 3.9.3
- gcloud-node version: 0.37.0
Steps to reproduce
var gcloud = require('gcloud')({
keyFilename: key,
projectId: 'xxxxx-projectId'
});
var gcs = gcloud.storage();
var bucket = gcs.bucket('xxxxxx-bucket');
gcs.getBuckets(function(err, buckets) {
if (!err) {
// buckets is an array of Bucket objects.
console.log(buckets);
}
});
Thanks! Activitystephenplusplus commented on Jul 22, 2016 What is the value of key? commit-master commented on Jul 22, 2016 ContributorAuthor More actions Its a JSON file downloaded from the Google Dev Console that has project_id, private_key_id, private_key, client_email, client_id, auth_uri
Also, if is change keyFilename by keyFile the error is gone but I get another one :
Error: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
stephenplusplus commented on Jul 22, 2016 Is it the object itself, or a string path to the file? If you want to provide an object, use credentials instead of keyFilename. keyFilename expects a string path to the JSON file, i.e. /Users/stephen/dev/keyfile.json. Reacted by Paul Borensztein commit-master commented on Jul 22, 2016 ContributorAuthor More actions Oh alright it's working now, using credentials. I suggest you add it to the documentation, it's pretty confusing (at least for me)
Thanks again ! 👍 stephenplusplus commented on Jul 22, 2016
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|