Comments (3)
@pvhieuit I believe you should be able to pass in an auth instance like this:
const authClient = auth.fromJSON(keys)
const client = new CloudBuild({
auth: authClient
})
from nodejs-cloudbuild.
@bcoe thank you for help, but it not working.
from nodejs-cloudbuild.
Where are you running the code? Depending on the environment, you can use the default authorization of the caller. If you don't specify auth, it uses the default. For instance, this works for me when I'm running locally:
// Imports the Google Cloud client library
const {CloudBuildClient} = require('@google-cloud/cloudbuild');
// Creates a client
const cb = new CloudBuildClient();
const request = {
projectId
}
const result = await cb.listBuildTriggers(request)
console.info(result)
If this doesn't work, you can try running gcloud auth application-default login
(info here) and then try again.
If you want to explicitly pass credentials through, you can use a service account key like this:
/ // Imports the Google Cloud client library
const {CloudBuildClient} = require('@google-cloud/cloudbuild');
client_options = {"keyFilename": "cloudbuildkey.json"}
// Creates a client
const cb = new CloudBuildClient(client_options)
const request = {
projectId
}
const result = await cb.listBuildTriggers(request)
console.info(result)
Make sure your service account has permission to use the Cloud Build API. I gave mine the Cloud Build Service Agent
role.
You can see more about authentication options here.
from nodejs-cloudbuild.
Related Issues (20)
- Documentation: Mocking/Stubbing certain functions requires stubbing parts of `google-gax` HOT 4
- Support usage in Deno with ESM HOT 1
- Synthesis failed for nodejs-cloudbuild HOT 1
- Synthesis failed for nodejs-cloudbuild HOT 3
- Cloud Builder Node.js createBuild API example HOT 1
- Synthesis failed for nodejs-cloudbuild HOT 2
- Update CODEOWNERS
- Synthesis failed for nodejs-cloudbuild HOT 1
- Create a build trigger connected to a GitHub repository through the API HOT 1
- Action Required: Fix Renovate Configuration
- Possibility to submit docker build HOT 3
- Warning: a recent release failed
- Sample Integration Tests: should run quickstart.js failed HOT 1
- listBuilds with filter throws INVALID_ARGUMENT: Request contains an invalid argument HOT 3
- Unable to create build with custom pool HOT 4
- runBuildTrigger does not include location as part of trigger path HOT 2
- Sample Integration Tests: should run quickstart.js failed HOT 4
- Sample Integration Tests: should run list-build-triggers.js failed HOT 1
- Integration Tests: should list triggers on project failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodejs-cloudbuild.