How did you install the Amplify CLI?
NPM
If applicable, what version of Node.js are you using?
22.22.3
Amplify CLI Version
14.5.1
What operating system are you using?
MacOs
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
When running amplify gen2-migration generate I receive the error:
→ Planning failed
🛑 Root resource not found for REST API '<redacted>'
fetchRestApiRootResourceId() in packages/amplify-cli/src/commands/gen2-migration/_common/aws-fetcher.ts (lines 192–198) calls API Gateway's GetResourcesCommand exactly once with no pagination:
public async fetchRestApiRootResourceId(restApiId: string): Promise<string> {
const { items } = await this.clients.apiGateway.send(new GetResourcesCommand({ restApiId }));
const root = items?.find((r) => r.path === '/');
if (!root?.id) {
throw new AmplifyError('RestApiResourceNotFoundError', {
message: `Root resource not found for REST API '${restApiId}'`,
GetResources paginates server-side (default page size 25, returns a position token) and item ordering isn't guaranteed to put / first. On any REST API with more than ~25 resources, / can land past page 1, this call never follows position, and generate/assess fails even though the API and its root resource are completely healthy.
Expected behavior
amplify gen2-migration generate is able to run without error on large REST APIs
Reproduction steps
Any Gen1 REST API category with 25+ Lambda-backed paths reproduces this. In our case (75 resources), root resource sits at position 66 in id order — confirmed via direct aws apigateway get-resources --no-paginate returning only 25 items, no root, with a position token present signaling more pages.
Project Identifier
No response
Log output
Details
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
How did you install the Amplify CLI?
NPM
If applicable, what version of Node.js are you using?
22.22.3
Amplify CLI Version
14.5.1
What operating system are you using?
MacOs
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
When running
amplify gen2-migration generateI receive the error:fetchRestApiRootResourceId()in packages/amplify-cli/src/commands/gen2-migration/_common/aws-fetcher.ts (lines 192–198) calls API Gateway's GetResourcesCommand exactly once with no pagination:GetResources paginates server-side (default page size 25, returns a position token) and item ordering isn't guaranteed to put / first. On any REST API with more than ~25 resources, / can land past page 1, this call never follows position, and generate/assess fails even though the API and its root resource are completely healthy.
Expected behavior
amplify gen2-migration generateis able to run without error on large REST APIsReproduction steps
Any Gen1 REST API category with 25+ Lambda-backed paths reproduces this. In our case (75 resources), root resource sits at position 66 in id order — confirmed via direct aws apigateway get-resources --no-paginate returning only 25 items, no root, with a position token present signaling more pages.
Project Identifier
No response
Log output
Details
Additional information
No response
Before submitting, please confirm: