amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

`ampx generate graphql-client-code` fails silently on Linux with no output

Open eklanke opened this issue 4 months ago • 2 comments

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 nvm to eliminate system-level installation issues.
  • Verifying the project root is clean of conflicting files.
  • Confirming the sandbox is running and amplify_outputs.json is correct and fully populated with the model introspection schema.
  • Removing the lib/models directory 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:

  1. Create a new Flutter project.
  2. Initialize an Amplify Gen2 backend with npx ampx init.
  3. Define a data schema in amplify/data/resource.ts (see schema below).
  4. Run npx ampx sandbox to deploy the backend. The sandbox deploys successfully and creates a valid amplify_outputs.json (see contents below).
  5. Run npx ampx generate graphql-client-code.

eklanke avatar Aug 03 '25 14:08 eklanke