I have two Next.js 12 apps running on AWS Amplify. They've been working well, but yesterday when I pushed the new code to Github and waited for my app to update, nothing happened. I did it few times and it didn't work. I started to investigate the problem and realized that AWS is not updating the old app, but creating always new environment (cloudfront, lambdas and s3). When I pushed the code earlier, everything worked correctly and Cloudfront created a new invalidation in the existing Cloudfront environment.
Does anyone have any information about this issue? Have they changed something or am I doing something wrong here? Thanks!
Edit: to be more specific, Amplify build finishes succesfully but in the deploy phase Amplify creates a new Cloudfront stack and not updating the old one. Amplify app address changes as well.
Build spec:
version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
More edit: Now I found out that my first project actual works as expected, but the second one creates always a new environment. So it has to be something (like git/cache/settings) in the project files that overrides the Amplify settings.