Skip to content

Amplify Gen 2 CDK Assembly Error: Missing `manifest.json` on First Build Attempt

0

I'm consistently running into the following issue when deploying an Amplify Gen 2 backend in my pipeline

{
  "name": "rirsystem",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack -p 3602",
    "build": "NEXTJS_DISABLE_ESLINT=true next build",
    "start": "next start -p 3602",
    "format": "prettier --check .",
    "format:fix": "prettier --write .",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  },
  "dependencies": {
    "@aws-amplify/adapter-nextjs": "^1.2.12",
    "@hookform/resolvers": "^5.0.1",
    "@radix-ui/react-accordion": "^1.2.10",
    "@radix-ui/react-avatar": "^1.1.3",
    "@radix-ui/react-collapsible": "^1.1.3",
    "@radix-ui/react-dialog": "^1.1.13",
    "@radix-ui/react-dropdown-menu": "^2.1.6",
    "@radix-ui/react-label": "^2.1.2",
    "@radix-ui/react-popover": "^1.1.13",
    "@radix-ui/react-select": "^2.1.6",
    "@radix-ui/react-separator": "^1.1.2",
    "@radix-ui/react-slot": "^1.2.2",
    "@radix-ui/react-switch": "^1.1.3",
    "@radix-ui/react-tabs": "^1.1.3",
    "@radix-ui/react-toast": "^1.2.6",
    "@radix-ui/react-tooltip": "^1.1.8",
    "@tanstack/react-query": "^5.69.0",
    "@tanstack/react-query-devtools": "^5.71.2",
    "aws-amplify": "^6.13.1",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "^1.1.1",
    "date-fns": "^3.6.0",
    "geist": "^1.3.1",
    "json-schema-to-ts": "^3.1.1",
    "lucide-react": "^0.483.0",
    "next": "^15.3.2",
    "next-themes": "^0.4.6",
    "react": "18.2.0",
    "react-day-picker": "^8.10.1",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.55.0",
    "sonner": "^2.0.3",
    "tailwind-merge": "^3.0.2",
    "tailwindcss-animate": "^1.0.7",
    "ts-algebra": "^2.0.0",
    "tw-animate-css": "^1.2.4",
    "zod": "^3.24.2",
    "zustand": "^5.0.3"
  },
  "devDependencies": {
    "@aws-amplify/backend": "1.14.1",
    "@aws-amplify/backend-cli": "^1.4.11",
    "@eslint/compat": "^1.2.9",
    "@eslint/eslintrc": "^3",
    "@tailwindcss/postcss": "^4",
    "@tanstack/eslint-plugin-query": "^5.74.7",
    "@types/node": "^22",
    "@types/react": "18.2.38",
    "@types/react-dom": "18.2.17",
    "@typescript-eslint/eslint-plugin": "^8.25.0",
    "@typescript-eslint/parser": "^8.25.0",
    "aws-cdk": "^2.1000.3",
    "aws-cdk-lib": "^2.180.0",
    "constructs": "^10.4.2",
    "esbuild": "^0.25.0",
    "eslint": "^9",
    "eslint-config-next": "15.2.3",
    "eslint-config-prettier": "^10.0.1",
    "postcss": "^8",
    "prettier": "^3.5.2",
    "prettier-plugin-tailwindcss": "^0.6.11",
    "tailwindcss": "^4",
    "typescript": "^5.8.2"
  },
  "optionalDependencies": {
    "@parcel/watcher": "^2.5.1"
  }
}
configuration

version: 1
backend:
  phases:
    preBuild:
        commands:
          - nvm install 20
          - nvm use 20
          - npm ci
    build:
      commands:
        - envCache --set stackInfo ""
        - npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID

frontend:
  phases:
    preBuild:
      commands:
        - nvm install 20
        - nvm use 20
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      - .next/cache/**/*
      - .npm/**/*

✅ Environment Details

  • Amplify Gen 2 (code-defined backend using @aws-amplify/backend)
  • CLI: @aws-amplify/cli@13.0.1
  • Node.js: v20.x
  • Region: eu-north-1
  • App ID: d3dccdxkhlqho8

✅ Notes

  • I’m not using dynamic enums or circular model references.
  • All models are defined statically and schema compiles without issue.
  • When I run the sandbox environment runs correctly
  • This looks like a race condition where CDK synth runs before schema/codegen completes.

❓My Question

Is this a known issue in Amplify Gen 2? Is there a documented or recommended way to enforce correct sequencing of codegen and CDK synth during CI?

Any guidance or ETA on a fix would be appreciated.

Thanks in advance!

asked 10 months ago494 views
1 Answer
0
Yes, this appears to be a known issue with Amplify Gen 2, particularly during the first build attempt in a CI/CD pipeline. The error you're encountering, where the `manifest.json` file is missing, is likely due to a race condition between the CDK synthesis process and the schema/codegen completion.

This issue often occurs because the CDK assembly tries to run before the necessary files have been generated by the Amplify backend processes. It's a timing problem that can be especially noticeable in CI/CD environments where processes are running concurrently.

While there isn't an official documented fix for this specific issue yet, there are a few workarounds you can try:

1. Add a delay or sleep command before the CDK synthesis step in your build process. This gives more time for the schema and codegen to complete.

2. Split your backend deployment into two separate steps: one for generating the necessary files, and another for the actual deployment. This can help ensure all required files are present before CDK synthesis begins.

3. Implement a retry mechanism in your CI/CD pipeline. If the first attempt fails due to the missing manifest, automatically trigger a second attempt which often succeeds.

4. Check if there are any recent updates to the Amplify CLI or backend packages that might address this issue. Keeping your dependencies up-to-date can sometimes resolve such problems.

As for an ETA on an official fix, it's best to keep an eye on the Amplify GitHub repository and forums for updates. The Amplify team is generally responsive to such issues and may be working on a more permanent solution.

In the meantime, implementing one of the workarounds mentioned above should help you proceed with your deployments while waiting for an official fix.
  

Sources
My Amplify environment started to fail in a sudden. Bootstrap Error | AWS re:Post
Build container ran out of memory | AWS re:Post

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.