When running npm run fullBuild, the build would sometimes fail when attempting to fetch AWS regions with the following error:
> ts-node ./build-scripts/generateResources.ts
Fetching AWS regions
Error: spawnSync /usr/local/bin/node ENOBUFS
at Object.spawnSync (node:internal/child_process:1119:20)
at spawnSync (node:child_process:847:24)
at Object.nodeNC [as fastestFunction] (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/node_modules/sync-rpc/lib/index.js:96:12)
at sendMessage (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/node_modules/sync-rpc/lib/index.js:118:29)
at /codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/node_modules/sync-rpc/lib/index.js:159:25
at Object.request (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/node_modules/sync-request/lib/index.js:28:15)
at fetchLatestRegions (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/build-scripts/generateResources.ts:37:28)
at Object.<anonymous> (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/build-scripts/generateResources.ts:211:22)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Module.m._compile (/codebuild/output/src1778635634/src/github.com/aws/aws-toolkit-azure-devops/node_modules/ts-node/src/index.ts:858:23)
Problem
The reason for this error is due to our use of the synchronous syncRequest for making the HTTP fetch request.
Solution
Make region fetching async using axios.get
Testing
Ran tests locally.
Replicated the linux codebuild job in my personal aws account and pointed those to my forked repo to confirm that this runs successfully.
Checklist
[x] I have read the README document
[x] I have read the CONTRIBUTING document
[x] My code follows the code style of this project
[ ] I have added tests to cover my changes
[ ] A short description of the change has been added to the changelog using the script npm run newChange
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Description
Background
When running
npm run fullBuild
, the build would sometimes fail when attempting to fetch AWS regions with the following error:Problem
The reason for this error is due to our use of the synchronous
syncRequest
for making the HTTP fetch request.Solution
Make region fetching async using
axios.get
Testing
Checklist
npm run newChange
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.