I have a next.js app which I want to deploy using AWS Amplify
hosting. Locally works fine, I can build and start the app properly.
I am using Bitbucket repository to upload files to Amplify which auto detects files to upload every push I make. But it gets stuck at Uploading files
even though I set build time out to two hours, anything else goes fine.
P.S This is a warning I get when deploying:
2025-02-12T11:56:53.406Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
.next
generated folder is 880MB
large.
This is amplify.yml:
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build -- --debug
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
This is .gitignore
:
# Node artifact files
node_modules/
dist/
# Compiled Java class files
*.class
# Compiled Python bytecode
*.py[cod]
# Log files
*.log
# Package files
*.jar
# Maven
target/
dist/
# JetBrains IDE
.idea/
# Unit test reports
TEST*.xml
# Generated by MacOS
.DS_Store
# Generated by Windows
Thumbs.db
# Applications
*.app
*.exe
*.war
# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv
.next
.env.local
.next
folder pushed to bitbucket? I think it should be ignored when pushing to the remote repository as it is generated at runtimeversion: 1 frontend: phases: preBuild: commands: - npm ci build: commands: - npm run build -- --debug artifacts: baseDirectory: .next files: - '**/*' cache: paths: - node_modules/**/*
amplify.yml
and.gitignore
?