Fix Next.js API route for Amplify WEB_COMPUTE platform
- Add .env.production for Amplify environment variable mapping - Update artifacts configuration for WEB_COMPUTE platform - Add explicit nodejs runtime for API route - Enable serverActions in Next.js config - Add debugging output for environment variables 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
5
.env.production
Normal file
5
.env.production
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# This file is for Amplify to know which env vars to expose to Next.js
|
||||||
|
# The actual values come from Amplify Environment Variables
|
||||||
|
CONFLUENCE_API_URL=${CONFLUENCE_API_URL}
|
||||||
|
CONFLUENCE_TOKEN=${CONFLUENCE_TOKEN}
|
||||||
|
CONFLUENCE_PAGE_ID=${CONFLUENCE_PAGE_ID}
|
||||||
10
amplify.yml
10
amplify.yml
@@ -5,13 +5,19 @@ frontend:
|
|||||||
commands:
|
commands:
|
||||||
- npm ci
|
- npm ci
|
||||||
- npm run security:check
|
- npm run security:check
|
||||||
|
# Print env vars for debugging (without exposing values)
|
||||||
|
- env | grep CONFLUENCE | sed 's/=.*/=***/'
|
||||||
build:
|
build:
|
||||||
commands:
|
commands:
|
||||||
- npm run build
|
- npm run build
|
||||||
artifacts:
|
artifacts:
|
||||||
baseDirectory: .next
|
baseDirectory: ./
|
||||||
files:
|
files:
|
||||||
- '**/*'
|
- .next/**/*
|
||||||
|
- node_modules/**/*
|
||||||
|
- package.json
|
||||||
|
- next.config.js
|
||||||
|
- public/**/*
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/**/*
|
- node_modules/**/*
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { fetchFromConfluence } from '../../../src/server/confluence';
|
import { fetchFromConfluence } from '../../../src/server/confluence';
|
||||||
|
|
||||||
|
export const runtime = 'nodejs';
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
try {
|
try {
|
||||||
// Get environment variables from server-side only
|
// Get environment variables from server-side only
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
// Remove output: 'standalone' for Amplify
|
// Ensure server-side features are enabled
|
||||||
|
experimental: {
|
||||||
|
serverActions: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = nextConfig
|
module.exports = nextConfig
|
||||||
Reference in New Issue
Block a user