Skip to content

Commit 900a5e3

Browse files
Added amplify.yaml, hopefully that fixes things
1 parent e5502c2 commit 900a5e3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

amplify.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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/**

0 commit comments

Comments
 (0)