Skip to content

chore: fix sample generation error when schema undefined - #3945

Open
pearigee wants to merge 2 commits into
mainfrom
pearigee-fix-sample-generation-error
Open

chore: fix sample generation error when schema undefined#3945
pearigee wants to merge 2 commits into
mainfrom
pearigee-fix-sample-generation-error

Conversation

@pearigee

Copy link
Copy Markdown
Contributor

We got the following error in the update-api workflow. We are making some unguarded access (on undefined variables) causing this error to be thrown.

This PR adds guarding to avoid throwing.

2026-07-28T01:46:00.7762143Z Failed to generate API: aiplatform:v1beta1
2026-07-28T01:46:00.7776739Z TypeError: Cannot read properties of undefined (reading 'properties')
2026-07-28T01:46:00.7778968Z     at flattenSchema (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/samplegen.js:117:14)
2026-07-28T01:46:00.7782073Z     at getSample (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/samplegen.js:72:27)
2026-07-28T01:46:00.7785198Z     at addFragments (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/samplegen.js:43:28)
2026-07-28T01:46:00.7788770Z     at async Generator.generate (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/generator.js:224:9)
2026-07-28T01:46:00.7791933Z     at async Generator.generateAPI (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/generator.js:209:24)
2026-07-28T01:46:00.7794939Z     at async /home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/build/src/generator/generator.js:110:17
2026-07-28T01:46:00.7796390Z     at async run (/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/node_modules/p-queue/dist/index.js:163:29)
2026-07-28T01:46:00.7797159Z aiplatform:v1beta1
2026-07-28T01:46:00.7797368Z -----------
2026-07-28T01:46:00.7797578Z [
2026-07-28T01:46:00.7798118Z   'Attempting first generateAPI call...',
2026-07-28T01:46:00.7798768Z   "GenerateAPI call failed with error: TypeError: Cannot read properties of undefined (reading 'properties'), moving on."
2026-07-28T01:46:00.7799561Z ]
2026-07-28T01:46:00.7799666Z 
2026-07-28T01:55:38.1811154Z Failed to generate API: poly:v1
2026-07-28T01:55:38.1833981Z [Error: ENOENT: no such file or directory, open '/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/discovery/poly-v1.json'] {
2026-07-28T01:55:38.1835469Z   errno: -2,
2026-07-28T01:55:38.1835807Z   code: 'ENOENT',
2026-07-28T01:55:38.1836146Z   syscall: 'open',
2026-07-28T01:55:38.1837256Z   path: '/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/discovery/poly-v1.json'
2026-07-28T01:55:38.1838749Z }
2026-07-28T01:55:38.1839077Z poly:v1
2026-07-28T01:55:38.1839367Z -----------
2026-07-28T01:55:38.1839675Z [
2026-07-28T01:55:38.1840083Z   'Attempting first generateAPI call...',
2026-07-28T01:55:38.1841957Z   "GenerateAPI call failed with error: Error: ENOENT: no such file or directory, open '/home/runner/work/google-api-nodejs-client/google-api-nodejs-client/google-api-nodejs-client-autodisco/discovery/poly-v1.json', moving on."
2026-07-28T01:55:38.1843621Z ]

@pearigee
pearigee requested a review from a team as a code owner July 28, 2026 20:31
@product-auto-label product-auto-label Bot added size: s Pull request size is small. samples Issues that are directly related to samples. labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant