-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next.js APP router SSG #3872
Comments
I am having the same issue. @calavera any tips? Thanks in advance. |
I think I found a solution:
Hope this helps you with your case too |
Amplify detect config Your SSG app when builded sucess => export folder Bug: When Reason: because Nextjs 14 is change way to build SSG page. They remove Way i fixed that:
Check it out here:
Key: Make sure Amplify detect your app build is SSG. |
I was unable to convince Amplify that my branch is not a SSR app. The only way I could get this working was with a little hack. |
We are currently working on this issue! Stay tuned |
I am trying to find the correct absolute path to my code files, but I cannot find my original code files, whether I use My My application is fine with my local // drizzle/migrate.ts
'use server'
import { migrate } from 'drizzle-orm/libsql/migrator'
import { resolve } from 'node:path'
import { getNamedDB } from './db'
const migrateDB = async (organizationName: string) => {
const db = await getNamedDB(organizationName)
const migrationsFolder = resolve(process.cwd(), './drizzle/migrations')
await migrate(db, { migrationsFolder })
}
export default migrateDB When I see what contents I have from function logFullPathToHere(cwd: string): void {
const parts = cwd.split(path.sep)
let fullPath = ''
parts.forEach((part, index) => {
fullPath = path.join(fullPath, part)
console.log(' '.repeat(index * 2) + fullPath)
})
}
logFullPathToHere(process.cwd()) | 2024-06-28T08:30:29.842Z | process.cwd() folder contents: [
-- | -- | --
| 2024-06-28T08:30:29.842Z | '.env',
| 2024-06-28T08:30:29.842Z | '.next',
| 2024-06-28T08:30:29.842Z | 'amplify-compute-bundle-output',
| 2024-06-28T08:30:29.842Z | 'node_modules',
| 2024-06-28T08:30:29.842Z | 'package.json',
| 2024-06-28T08:30:29.842Z | 'public',
| 2024-06-28T08:30:29.842Z | 'server.js'
| 2024-06-28T08:30:29.842Z | ] version: 1
frontend:
phases:
preBuild:
commands:
- corepack enable
- pnpm install --frozen-lockfile
- pnpm setup-env
- pnpm migrate
build:
commands:
- pnpm build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- node_modules/**/* How may I locate and access my project files from my NextJS App Router SSR Amplify built application? |
Hello folks - this has been addressed! You can convert an SSR App to SSG for NextJS 14+ applications. Look at the updated docs here -> You would need to commit a change in their nextConfig with `output: 'export' and Amplify Hosting will automatically switch to SSG for you! |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Before opening, please confirm:
App Id
d1fn6pdw73hgp
AWS Region
ap-southeast-1
Amplify Hosting feature
Build settings
Frontend framework
Next.js
Next.js version
13.4.12
Next.js router
App Router
Describe the bug
I tried to convert the Next.js SSR to SSG by following the FAQ. However the app platform and branch framework always change back to Web dynamic and Next.js SSR during the build.
After I added command
- envCache --set stackInfo ""
, the platform and framework seems not change back, but the frontend build doesn't start becausenext export
does not work with App Router.If I change to
next build
and configure the "output: export" in next.config.js, the build works locally but Amplify changes the app to web platform and SSR.Expected behavior
Can deploy Next.js App Router SSG app.
Reproduction steps
Build Settings
Log output
Additional information
No response
The text was updated successfully, but these errors were encountered: