1 Answer
- Newest
- Most votes
- Most comments
0
I'm going to answer my own question as I figured out the issue and solution after not finding it elsewhere. I verified the following:
- The appsync api for the local environment and the deployed environment match.
- The dynamodb configuration for the local environment and the deployed environment match.
- Redeploying the backend numerous times didnt resolve the issue.
Ultimately I realized that something was being cached when my local environment was up to date while the deployed environments were not. Amplify was caching some part of the build process that included the previous iteration of dynamodb. I had to modify the build settings (amplify.yml) so that it would temporarily stop caching. Specifically this was the original/previous version of amplify.yml
version: 1
backend:
phases:
build:
commands:
- npm ci --cache .npm --prefer-offline
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- .npm/**/*
and I modified it to this
version: 1
backend:
phases:
build:
commands:
- rm -rf .npm # Clear npm cache to ensure fresh dependencies
- npm ci --cache .npm --prefer-offline
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
preBuild:
commands:
- rm -rf .next/cache # Clear Next.js cache to ensure fresh build
- rm -rf .npm # Clear npm cache to ensure fresh dependencies
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths: []
# Temporarily disable caching during this deployment
# Re-enable it in the future by restoring the paths below:
# paths:
# - .next/cache/**/*
# - .npm/**/*
answered 25 days ago
Relevant content
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
Also, I just created 2 additional urls, staging and develop, that are tied to the staging and develop branches of my github repository. Both of the new branches/domains are using the same api and tables as the original and both show the correct amount of new records. So it seems like something with the original is being cached somewhere but I can't tell where/how.