How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.20.8
Amplify CLI Version
14.5.0
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
Running amplify codegen add --apiId <api-id> --region fails with the error "A dynamic import callback was not specified" after selecting the app type and framework. The command fails at the "Getting API details" step.
This occurs on a fresh Create React App project without amplify init having been run. The error also reproduces on Node.js v24.17.0.
Expected behavior
The command should successfully connect to the AppSync API and proceed with codegen configuration as described in AppSync API Console.
Reproduction steps
- Create a new React app:
npx create-react-app test-app-schema-test
cd test-app-schema-test
- Run codegen add with an existing AppSync API:
amplify codegen add --apiId <api-id> --region
- Select "javascript" for app type
- Select "react" for framework
- Command fails with: "A dynamic import callback was not specified."
Tested on both Node.js v18.20.8 and v24.17.0 — same result.
Project Identifier
amplify diagnose --send-report
⚠️ WARNING: AWS Amplify Gen 1 CLI is in maintenance mode and will reach end of life on May 1, 2027.
During maintenance mode, only critical bug fixes and security patches will be provided.
Migrate to Amplify Gen 2: https://docs.amplify.aws/react/start/migrate-to-gen2/
Learn more at https://docs.amplify.aws/cli/reference/diagnose/
⠋ Creating Zip
No Amplify backend project files detected within this folder.
✖ Creating Zip
Log output
Details
⚠️ WARNING: AWS Amplify Gen 1 CLI is in maintenance mode and will reach end of life on May 1, 2027.
During maintenance mode, only critical bug fixes and security patches will be provided.
Migrate to Amplify Gen 2: https://docs.amplify.aws/react/start/migrate-to-gen2/
? Choose the type of app that you're building javascript
? What javascript framework are you using react
✖ Getting API details
A dynamic import callback was not specified.
Additional information
- The
--debug flag does not provide additional stack trace information beyond the error message.
- Would be helpful if the CLI provided a more descriptive error message indicating the root cause (e.g., missing Amplify initialization, plugin loading failure, etc.).
Before submitting, please confirm:
Workaround
Option A: Download schema via AWS CLI
-
Download the schema from AppSync:
aws appsync get-introspection-schema --api-id --region eu-west-2 --format SDL schema.graphql
-
Place the schema.graphql file in the root of the project.
-
Run codegen without --apiId:
amplify codegen add
Option B: Manually place schema file
-
Copy or create your "schema.graphql" file in the root of the project (e.g., export it from the AppSync console).
-
Run codegen without --apiId:
amplify codegen add
-
Follow the prompts:
? Choose the type of app that you're building: javascript
? What javascript framework are you using: react
? Choose the code generation language target: javascript
? Enter the file name pattern of graphql queries, mutations and subscriptions: src/graphql/**/*.js
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions: Yes
? Enter maximum statement depth: 2
✔ Generated GraphQL operations successfully and saved at src/graphql
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.20.8
Amplify CLI Version
14.5.0
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
Running
amplify codegen add --apiId <api-id> --regionfails with the error "A dynamic import callback was not specified" after selecting the app type and framework. The command fails at the "Getting API details" step.This occurs on a fresh Create React App project without amplify init having been run. The error also reproduces on Node.js v24.17.0.
Expected behavior
The command should successfully connect to the AppSync API and proceed with codegen configuration as described in AppSync API Console.
Reproduction steps
amplify codegen add --apiId <api-id> --regionTested on both Node.js v18.20.8 and v24.17.0 — same result.
Project Identifier
amplify diagnose --send-report
During maintenance mode, only critical bug fixes and security patches will be provided.
Migrate to Amplify Gen 2: https://docs.amplify.aws/react/start/migrate-to-gen2/
Learn more at https://docs.amplify.aws/cli/reference/diagnose/
⠋ Creating Zip
No Amplify backend project files detected within this folder.
✖ Creating Zip
Log output
Details
Additional information
--debugflag does not provide additional stack trace information beyond the error message.Before submitting, please confirm:
Workaround
Option A: Download schema via AWS CLI
Download the schema from AppSync:
aws appsync get-introspection-schema --api-id --region eu-west-2 --format SDL schema.graphql
Place the schema.graphql file in the root of the project.
Run codegen without --apiId:
amplify codegen add
Option B: Manually place schema file
Copy or create your "schema.graphql" file in the root of the project (e.g., export it from the AppSync console).
Run codegen without --apiId:
amplify codegen add
Follow the prompts:
? Choose the type of app that you're building: javascript
? What javascript framework are you using: react
? Choose the code generation language target: javascript
? Enter the file name pattern of graphql queries, mutations and subscriptions: src/graphql/**/*.js
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions: Yes
? Enter maximum statement depth: 2
✔ Generated GraphQL operations successfully and saved at src/graphql