amplify-backend
amplify-backend copied to clipboard
`ampx generate graphql-client-code` fails silently on Linux with no output
Environment information
### [Bug]: `ampx generate graphql-client-code` fails silently on Linux with no output
**Describe the bug**
The `npx ampx generate graphql-client-code` command fails to generate any Dart model files for a Flutter project. It exits immediately with code `0` and produces no output or error messages, even with the `--debug` flag. The `lib/models` directory is either left empty or is not created at all.
**Expected behavior**
The command should generate Dart model files in the `lib/models` directory corresponding to the schema.
**Actual behavior**
The command completes instantly with no output and no files are generated. `echo $?` returns `0`.
**Environment:**
- Amplify CLI Version: `[email protected]` (or latest)
- Node.js Version: `v22.18.0`
- NPM Version: `10.9.3`
- OS: Linux (Ubuntu on ThinkPad L14 Gen 2)
---
**`amplify/data/resource.ts`**
Describe the bug
Additional context We have exhaustively debugged the local environment, including:
- Ensuring a clean project state (no
node_modules,package-lock.json). - Clearing the global npm cache (
npm cache clean --force). - Upgrading Node.js and npm via
nvmto eliminate system-level installation issues. - Verifying the project root is clean of conflicting files.
- Confirming the sandbox is running and
amplify_outputs.jsonis correct and fully populated with the model introspection schema. - Removing the
lib/modelsdirectory before generation.
None of these steps resolved the issue, which strongly points to a bug within the ampx code generation logic itself on this specific platform.
Reproduction steps
To Reproduce Steps to reproduce the behavior:
- Create a new Flutter project.
- Initialize an Amplify Gen2 backend with
npx ampx init. - Define a data schema in
amplify/data/resource.ts(see schema below). - Run
npx ampx sandboxto deploy the backend. The sandbox deploys successfully and creates a validamplify_outputs.json(see contents below). - Run
npx ampx generate graphql-client-code.