Skip to content

Is the amplify/ folder required in the Git repo for Next.js SSR (Gen 1) full-stack deployment on Amplify Hosting?

0

Subject: Is the amplify/ folder required in the Git repo for Next.js SSR (Gen 1) full-stack deployment on Amplify Hosting? Hello community,

I have developed a Next.js SSR application utilizing Amplify Gen 1 for the backend (Cognito for Auth, DynamoDB, S3 for Storage). I am deploying this application via Git-based CI/CD on Amplify Hosting.

Details of my setup: Backend Creation: The backend was set up using Amplify CLI commands (amplify init, amplify add auth, amplify add storage), which generated the full-stack configuration and created the root-level amplify/ directory containing the CloudFormation (IaC) templates.

Deployment Method: Deployment is handled by connecting the Git repository directly to the Amplify Console, as is necessary for Next.js SSR apps.

Amplify Console Project: I understand that there are two logical "apps" involved: the deployed Next.js SSR frontend, and the provisioned Amplify Backend environment.

The Main Question (and Prior Research): For this full-stack deployment model, where the frontend needs to synchronize with a Gen 1 Amplify Backend, is it strictly necessary to include the entire amplify/ directory in the Git repository?

Prior Research / Observation: My initial deployment attempts failed when I added the amplify/ folder to my .gitignore and pushed the code. The build only succeeded when I included the entire amplify/ folder in the Git repository.

This suggests that the Amplify Hosting build process requires access to the CloudFormation templates within this directory to perform the necessary backend checks and updates (i.e., the amplify push part of the process) before deploying the frontend.

Could someone from the AWS team or the community please provide an authoritative confirmation on whether the amplify/ folder is a mandatory requirement in the Git repo for full-stack, Gen 1 deployments via the Amplify Console's CI/CD pipeline?

asked 10 months ago109 views

2 Answers
0

Yes, the amplify/ folder is required in your Git repository for Next.js SSR (Gen 1) full-stack deployments on Amplify Hosting.

When you deploy using Amplify's Git-based CI/CD and hosting service, Amplify needs access to the CloudFormation templates and configuration files contained in the amplify/ directory to properly provision and manage your backend resources. During the deployment process, Amplify will provision a build environment, clone your repository, deploy your Amplify backend, and then deploy your frontend.

This is why your deployment attempts failed when you added the amplify/ folder to .gitignore but succeeded when you included it in your repository. The Amplify Hosting build process requires these files to perform the necessary backend checks and updates (essentially running an "amplify push" operation) before deploying your frontend.

When you initialize an Amplify project with the "amplify init" command, it creates this folder structure in your project's root directory with the initial project configuration and generates the project metadata files. These files are essential for Amplify to understand and manage your backend resources during the CI/CD process.
Sources
Deploy and host app - Next.js - AWS Amplify Documentation
How Amplify works - Next.js - AWS Amplify Documentation
Explore key workflows for Amplify CLI - Next.js - AWS Amplify Documentation

answered 10 months ago

0

Hey,

Hope you're keeping well.

For Amplify Gen 1 full‑stack deployments, the amplify/ folder must be present in the connected Git repo. That directory contains the backend environment configuration, CloudFormation templates, and team-provider-info.json that the Amplify Console build process uses to run amplify pull or amplify push during deployment. If it’s missing, the build can’t reconcile the frontend with your existing backend resources, which is why your deployment failed when it was git‑ignored.

Thanks and regards,
Taz

answered 8 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.