[GH-ISSUE #163] Could not load the default credentials #2178

Closed
opened 2026-03-15 17:55:26 +03:00 by kerem · 3 comments
Owner

Originally created by @ahmck on GitHub (Jan 14, 2020).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/163

Hey, I'm trying to upload a file in node but I get the following error:

Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:161:19)
at async GoogleAuth.getClient (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:503:17)
at async GoogleAuth.request (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:544:24)
at async Upload.makeRequest (.../node_modules/gcs-resumable-upload/build/src/index.js:316:21)
at async Upload.createURIAsync (.../node_modules/gcs-resumable-upload/build/src/index.js:142:22)`

Here is the code:

const storage = new Storage({
    apiEndpoint: "127.0.0.1:4443",
    projectId: "test",
});

const bucket = storage.bucket('sample-bucket');
const uploadStream = bucket.file(fileName).createWriteStream();
fileStream.pipe(uploadStream);`

Interestingly getting the buckets using your node example works just fine.

I also tried supplying empty credentials but that just complained further

const storage = new Storage({
    apiEndpoint: "127.0.0.1:4443",
    projectId: "test",
    credentials: {},
});

I might be out of luck just by nature of how the google node storage library works but any suggestions would be greatly appreciated, thanks!

Originally created by @ahmck on GitHub (Jan 14, 2020). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/163 Hey, I'm trying to upload a file in node but I get the following error: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information. at GoogleAuth.getApplicationDefaultAsync (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:161:19) at async GoogleAuth.getClient (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:503:17) at async GoogleAuth.request (.../node_modules/@google-cloud/storage/node_modules/google-auth-library/build/src/auth/googleauth.js:544:24) at async Upload.makeRequest (.../node_modules/gcs-resumable-upload/build/src/index.js:316:21) at async Upload.createURIAsync (.../node_modules/gcs-resumable-upload/build/src/index.js:142:22)` Here is the code: const storage = new Storage({ apiEndpoint: "127.0.0.1:4443", projectId: "test", }); const bucket = storage.bucket('sample-bucket'); const uploadStream = bucket.file(fileName).createWriteStream(); fileStream.pipe(uploadStream);` Interestingly getting the buckets using your node example works just fine. I also tried supplying empty credentials but that just complained further const storage = new Storage({ apiEndpoint: "127.0.0.1:4443", projectId: "test", credentials: {}, }); I might be out of luck just by nature of how the google node storage library works but any suggestions would be greatly appreciated, thanks!
kerem closed this issue 2026-03-15 17:55:31 +03:00
Author
Owner

@jamespedid commented on GitHub (Jan 27, 2020):

@ahmck I'm having this same issue. Did you determine how to solve the issue, or did you abandon it?

<!-- gh-comment-id:578855778 --> @jamespedid commented on GitHub (Jan 27, 2020): @ahmck I'm having this same issue. Did you determine how to solve the issue, or did you abandon it?
Author
Owner

@ahmck commented on GitHub (Jan 27, 2020):

Hey @jamespedid, I abandoned it. For local use I am now just running a container with nginx that serves files that are volume mounted.

<!-- gh-comment-id:578911833 --> @ahmck commented on GitHub (Jan 27, 2020): Hey @jamespedid, I abandoned it. For local use I am now just running a container with nginx that serves files that are volume mounted.
Author
Owner

@jamespedid commented on GitHub (Jan 28, 2020):

Cool. I think the problems are actually in the google-cloud/storage library myself. There are some functions that aren't respecting the apiEndpoint that you enter. I ended up switching to minio and I'm going to use that with the gcs gateway for non-developer environments.

<!-- gh-comment-id:579030961 --> @jamespedid commented on GitHub (Jan 28, 2020): Cool. I think the problems are actually in the google-cloud/storage library myself. There are some functions that aren't respecting the apiEndpoint that you enter. I ended up switching to minio and I'm going to use that with the gcs gateway for non-developer environments.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#2178
No description provided.