When I deploy to AWS Amplify my next js app using the standard Build settings-
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '/*'
cache:
paths:
- node_modules//*
everything works, but my application uses environment variables, when I change build settings to the settings to those in the documentation -
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- env | grep -e NEXTAUTH_URL -e NEXTAUTH_SECRET -e MONGODB_URI >> .env.production
- env | grep -e NEXT_PUBLIC_ >> .env.production
- npm run build
artifacts:
baseDirectory: .next
files:
- '/*'
cache:
paths:
- node_modules//*
- .next/cache/**/*
, I get errors. What do I need to do?