File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ version : 1
2+ applications :
3+ - frontend :
4+ phases :
5+ preBuild :
6+ commands :
7+ # Install dependencies
8+ - npm ci || npm install
9+ # Surface key environment variables into a Next.js .env file so they are available at build (and SSR runtime picks them up)
10+ # IMPORTANT: Define MONGO_URI (and any others) in Amplify Console App Settings > Environment variables.
11+ # These echo lines DO NOT hardcode secrets; they just write whatever Amplify injects at build time.
12+ - echo "MONGO_URI=$MONGO_URI" >> .env
13+ - echo "MONGO_URI=$MONGO_URI" >> .env.production
14+ # If you have public variables prefixed with NEXT_PUBLIC_, add them similarly:
15+ # - echo "NEXT_PUBLIC_API_BASE=$NEXT_PUBLIC_API_BASE" >> .env
16+ build :
17+ commands :
18+ # Optional: show which env vars resolved (avoid printing secrets—mask length only)
19+ - echo "Building with MONGO_URI length : ${#MONGO_URI}"
20+ - npm run build
21+ artifacts :
22+ # For Next.js the build output served by Amplify Hosting is in .next (not 'build' like CRA)
23+ baseDirectory : .next
24+ files :
25+ - ' **/*'
26+ cache :
27+ paths :
28+ - node_modules/**/*
29+ - .next/cache/**
You can’t perform that action at this time.
0 commit comments