While there were numerous questions about this topic, I am specifically seeking solutions for amplify.
Below are the logs from my amplify build:
2024-01-14T16:14:17.626Z [INFO]: # Cloning repository: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="63040a1723040a170b16014d000c">[email protected]</a>:anay-208/portfolio.git
2024-01-14T16:14:19.076Z [INFO]:
2024-01-14T16:14:19.077Z [INFO]: Cloning into 'portfolio'...
2024-01-14T16:14:19.077Z [INFO]: # Switching to commit: 893dd0dc396a332bc2055fe3df3086a8e20ecde9
2024-01-14T16:14:19.090Z [INFO]: Note: switching to '893dd0dc396a332bc2055fe3df3086a8e20ecde9'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 893dd0d Update email address in Introduction component
2024-01-14T16:14:19.134Z [INFO]: Successfully cleaned up Git credentials
2024-01-14T16:14:19.134Z [INFO]: # Checking for Git submodules at: /codebuild/output/src504315270/src/portfolio/.gitmodules
2024-01-14T16:14:19.141Z [INFO]: # Retrieving environment cache...
2024-01-14T16:14:19.173Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2024-01-14T16:14:19.173Z [INFO]: ---- Setting Up SSM Secrets ----
2024-01-14T16:14:19.173Z [INFO]: SSM params {"Path":"/amplify/d36nuq8xnduv8k/main/","WithDecryption":true}
2024-01-14T16:14:20.188Z [INFO]: No live updates for this build run
2024-01-14T16:14:20.191Z [INFO...
<p>Here is my amplify.yml:</p>
<pre><code>version: 1
backend:
phases:
build:
commands:
- nvm install 20
- nvm use 20
- npm ci
- npx amplify pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
It seems that updating nextjs to the latest stable version (^14.0.4) helped resolve the issue I was facing.
You can find the source code of this project here.
Any assistance on this matter would be greatly appreciated.