-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
I have this code:
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;
const util = require('util');
const build = new CloudBuildClient();
const paths = [
'healthcare/datasets',
'healthcare/dicom',
'healthcare/fhir',
'healthcare/hl7v2',
];
async function main() {
const projectId = await build.getProjectId();
const [triggers] = await build.listBuildTriggers({projectId});
for (const trigger of triggers) {
console.log(util.inspect(trigger, false, 6));
}
for (const path of paths) {
const name = `nodejs-docs-samples-${path.replace('/', '-')}`;
const exists = triggers.find(x => x.name === name);
const triggerRequest = {
projectId,
trigger: {
name,
serviceAccount:
'kokoro-system-test@long-door-651.iam.gserviceaccount.com',
includedFiles: [`${path}/**`],
github: {
installationId: '0',
owner: 'GoogleCloudPlatform',
name: 'nodejs-docs-samples',
pullRequest: {
commentControl: 'COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY',
invertRegex: false,
branch: '^main$',
gitRef: 'branch',
},
event: 'pullRequest',
},
build: {
steps: [
{
name: 'node:14',
entrypoint: 'npm',
args: ['install', '--unsafe-perm'],
dir: path,
},
{
name: 'node:14',
entrypoint: 'npm',
args: ['run', 'test'],
dir: path,
},
],
},
},
};
if (exists) {
console.log(`updating trigger ${name}...`);
await build.updateBuildTrigger(triggerRequest);
} else {
console.log(`creating trigger ${name}...`);
await build.createBuildTrigger(triggerRequest);
}
}
}
main().catch(e => {
console.error(e);
throw e;
});And I'm getting a stack trace like this:
(node:90035) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Request contains an invalid argument.
at Object.callErrorFromStatus (/Users/beckwith/Code/nodejs-docs-samples/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/Users/beckwith/Code/nodejs-docs-samples/node_modules/@grpc/grpc-js/build/src/client.js:179:52)
at Object.onReceiveStatus (/Users/beckwith/Code/nodejs-docs-samples/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/Users/beckwith/Code/nodejs-docs-samples/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /Users/beckwith/Code/nodejs-docs-samples/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
at processTicksAndRejections (internal/process/task_queues.js:77:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:90035) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:90035) [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.
Nothing in that stack trace points to the actual line of code where the request as made. This makes it super hard to know which call actually caused the exception.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.