aws-amplify / aws-amplify/amplify-hosting

Next JS - Build Error with hybrid SSR / SSG Deployment

Open
#2,884 8 comments 0 reactions 0 assignees View on GitHub
frontend-builds ssr
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

964326755670

### Region

eu-central-1

### Amplify Hosting feature

Build settings

### Describe the bug

I tried to host my Next.js App with SSR, SSG, ISR. But I got the following error in the frontend step. A deployment with only SSR on Amplify worked perfectly. Beyond that my SSR, SSG, ISR setup worked fine locally.

```2022-07-24T16:19:12.509Z [INFO]: Git SSH Key acquired
2022-07-24T16:19:12.668Z [INFO]: # Cloning repository: git@gitlab.com:***/***.git
2022-07-24T16:19:16.664Z [INFO]: Agent pid 141
2022-07-24T16:19:16.737Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
Cloning into '***'...
Warning: Permanently added the ECDSA host key for IP address '172.65.251.78' to the list of known hosts.
2022-07-24T16:19:16.737Z [INFO]: # Switching to commit: 5752f15d115c463af22fa5b120d53001754ae361
2022-07-24T16:19:16.784Z [INFO]: Agent pid 154
2022-07-24T16:19:16.784Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
Note: switching to '5752f15d115c463af22fa5b120d53001754ae361'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 5752f15 enabled ssr in ampliofy
2022-07-24T16:19:16.872Z [INFO]: Successfully cleaned up Git credentials
2022-07-24T16:19:16.872Z [INFO]: # Checking for Git submodules at: /codebuild/output/src175539022/src/homeofopensource/.gitmodules
2022-07-24T16:19:16.898Z [INFO]: # Retrieving environment cache...
2022-07-24T16:19:16.952Z [INFO]: # Retrieved environment cache
2022-07-24T16:19:16.953Z [INFO]: ---- Setting Up SSM Secrets ----
2022-07-24T16:19:16.953Z [INFO]: SSM params {"Path":"/amplify/dqjh6lcvjv24j/dev/","WithDecryption":true}
2022-07-24T16:19:26.001Z [INFO]: # Node version 14.17.0 is available for installation
2022-07-24T16:19:26.077Z [INFO]: # Installing Node version 14.17.0
2022-07-24T16:19:32.991Z [INFO]: # Now using Node version 14.17.0
2022-07-24T16:19:34.906Z [WARNING]: Cannot find module '/root/.nvm/versions/node/v14.17.0/lib/node_modules/@aws-amplify/cli/package.json'
Require stack:
- /snapshot/AWSMobilePioneerExecute/src/plugins/patch/npm.js
- /snapshot/AWSMobilePioneerExecute/src/plugins/patch/patch.js
- /snapshot/AWSMobilePioneerExecute/pioneer.js
2022-07-24T16:19:34.907Z [INFO]: # Patching NPM package '@aws-amplify/cli' to 9.1.0...
2022-07-24T16:19:54.973Z [INFO]: # Done patching NPM package '@aws-amplify/cli' to version 9.1.0
2022-07-24T16:19:55.231Z [INFO]: # Last deployed commit: 5e4c69fe136d4877b417ff7c9651ef24be0c417f
2022-07-24T16:19:55.983Z [INFO]: # Retrieving cache...
2022-07-24T16:20:06.358Z [INFO]: # Extracting cache...
2022-07-24T16:20:13.416Z [INFO]: # Extraction completed
2022-07-24T16:20:17.695Z [INFO]: ## Starting Backend Build
# Starting phase: build
2022-07-24T16:20:19.685Z [INFO]: Amplify AppID found: dqjh6lcvjv24j. Amplify App name is: homeofos
2022-07-24T16:20:19.736Z [INFO]: Backend environment dev found in Amplify Console app: homeofos
2022-07-24T16:20:20.371Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2022-07-24T16:20:20.958Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2022-07-24T16:20:20.963Z [INFO]: ✅
2022-07-24T16:20:22.522Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2022-07-24T16:20:23.356Z [WARNING]: - Initializing your environment: dev
2022-07-24T16:20:23.854Z [WARNING]: ✔ Initialized provider successfully.
2022-07-24T16:20:23.900Z [WARNING]: - Updating resources in the cloud. This may take a few minutes...
2022-07-24T16:20:24.473Z [INFO]: ✅ Initialized your environment successfully.
2022-07-24T16:20:24.475Z [INFO]: Your project has been successfully initialized and connected to the cloud!
Some next steps:
"amplify status" will show you what you've added already and if it's locally configured or deployed
"amplify add " will allow you to add features like user login or a backend API
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify console" to open the Amplify Console and view your project status
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
Pro tip:
Try "amplify add api" to create a backend API and then "amplify push" to deploy everything
⚠️ The maximum number of apps that you can create with Amplify in this region has likely been reached:
For more information on Amplify Service Quotas, see:
https://docs.aws.amazon.com/general/latest/gr/amplify.html#service-quotas-amplify
2022-07-24T16:20:26.353Z [INFO]: # Completed phase: build
## Completed Backend Build
2022-07-24T16:20:26.356Z [INFO]: ## Starting Frontend Build
# Starting phase: preBuild
2022-07-24T16:20:26.357Z [INFO]: # Executing command: yarn install
2022-07-24T16:20:26.612Z [INFO]: yarn install v1.22.0
2022-07-24T16:20:26.724Z [INFO]: [1/4] Resolving packages...
2022-07-24T16:20:27.265Z [INFO]: [2/4] Fetching packages...
2022-07-24T16:21:10.786Z [INFO]: info @next/swc-darwin-arm64@11.1.4: The platform "linux" is incompatible with this module.
2022-07-24T16:21:10.793Z [INFO]: info "@next/swc-darwin-arm64@11.1.4" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-darwin-arm64@11.1.4: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-x64@11.1.4: The platform "linux" is incompatible with this module.
info "@next/swc-darwin-x64@11.1.4" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-x64-msvc@11.1.4: The platform "linux" is incompatible with this module.
info "@next/swc-win32-x64-msvc@11.1.4" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
2022-07-24T16:21:10.824Z [INFO]: [3/4] Linking dependencies...
2022-07-24T16:21:10.827Z [WARNING]: warning " > @urql/devtools@2.0.3" has unmet peer dependency "@urql/core@>= 1.14.0".
2022-07-24T16:21:10.829Z [WARNING]: warning " > autoprefixer@10.4.7" has unmet peer dependency "postcss@^8.1.0".
2022-07-24T16:21:10.830Z [WARNING]: warning "aws-amplify > @aws-amplify/analytics > @aws-sdk/client-firehose > @aws-sdk/middleware-retry > react-native-get-random-values@1.8.0" has unmet peer dependency "react-native@>=0.56".
2022-07-24T16:21:10.832Z [WARNING]: warning "react-hot-toast > goober@2.1.9" has unmet peer dependency "csstype@^3.0.10".
2022-07-24T16:21:10.833Z [WARNING]: warning "react-notion-x > react-image@4.0.3" has unmet peer dependency "@babel/runtime@>=7".
2022-07-24T16:21:10.833Z [WARNING]: warning "react-notion-x > react-lazy-images@1.1.0" has incorrect peer dependency "react@^15 || ^16".
warning "react-notion-x > react-lazy-images@1.1.0" has incorrect peer dependency "react-dom@^15 || ^16".
2022-07-24T16:21:10.835Z [WARNING]: warning "react-notion-x > react-pdf > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
2022-07-24T16:21:10.839Z [WARNING]: warning " > tailwindcss@3.0.24" has unmet peer dependency "postcss@^8.0.9".
2022-07-24T16:21:11.004Z [WARNING]: warning Workspaces can only be enabled in private projects.
2022-07-24T16:21:28.234Z [INFO]: [4/4] Building fresh packages...
2022-07-24T16:21:45.521Z [INFO]: $ husky install
2022-07-24T16:21:45.582Z [INFO]: husky - Git hooks installed
2022-07-24T16:21:45.585Z [INFO]: Done in 78.98s.
2022-07-24T16:21:45.617Z [INFO]: # Completed phase: preBuild
# Starting phase: build
# Executing command: yarn run build
2022-07-24T16:21:45.751Z [INFO]: yarn run v1.22.0
2022-07-24T16:21:45.785Z [INFO]: $ yarn run generate
2022-07-24T16:21:45.962Z [INFO]: $ yarn run generate:prisma && yarn run generate:graphql-codegen
2022-07-24T16:21:46.137Z [INFO]: $ prisma generate
2022-07-24T16:21:47.303Z [INFO]: Prisma schema loaded from src/server/db/schema.prisma
2022-07-24T16:21:48.783Z [INFO]: ✔ Generated Prisma Client (3.14.0 | library) to ./node_modules/@prisma/client in 244ms
✔ Generated Pothos integration to ./src/server/graphql/pothos-types.generated.ts in 47ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
2022-07-24T16:21:49.017Z [INFO]: $ graphql-codegen
2022-07-24T16:21:49.707Z [INFO]: [16:21:49] Parse configuration [started]
2022-07-24T16:21:49.709Z [INFO]: [16:21:49] Parse configuration [completed]
2022-07-24T16:21:49.710Z [INFO]: [16:21:49] Generate outputs [started]
2022-07-24T16:21:49.711Z [INFO]: [16:21:49] Generate src/client/graphql/types.generated.ts [started]
2022-07-24T16:21:49.711Z [INFO]: [16:21:49] Generate to ./ (using EXPERIMENTAL preset "near-operation-file") [started]
2022-07-24T16:21:49.711Z [INFO]: [16:21:49] Load GraphQL schemas [started]
2022-07-24T16:21:49.711Z [INFO]: [16:21:49] Load GraphQL schemas [started]
2022-07-24T16:21:49.750Z [INFO]: [16:21:49] Load GraphQL schemas [completed]
2022-07-24T16:21:49.751Z [INFO]: [16:21:49] Load GraphQL schemas [completed]
[16:21:49] Load GraphQL documents [started]
[16:21:49] Load GraphQL documents [started]
2022-07-24T16:21:50.690Z [INFO]: [16:21:50] Load GraphQL documents [completed]
2022-07-24T16:21:50.690Z [INFO]: [16:21:50] Load GraphQL documents [completed]
[16:21:50] Generate [started]
[16:21:50] Generate [started]
2022-07-24T16:21:50.811Z [INFO]: [16:21:50] Generate [completed]
2022-07-24T16:21:50.812Z [INFO]: [16:21:50] Generate [completed]
[16:21:50] Generate src/client/graphql/types.generated.ts [completed]
[16:21:50] Generate to ./ (using EXPERIMENTAL preset "near-operation-file") [completed]
[16:21:50] Generate outputs [completed]
2022-07-24T16:21:51.976Z [INFO]: $ next build
2022-07-24T16:21:52.699Z [INFO]: info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
2022-07-24T16:21:52.817Z [INFO]: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2022-07-24T16:21:52.829Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2022-07-24T16:21:52.829Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
2022-07-24T16:21:52.862Z [INFO]: info - Checking validity of types...
2022-07-24T16:22:10.305Z [WARNING]: error - ESLint must be installed in order to run during builds: yarn add --dev eslint
2022-07-24T16:22:10.307Z [INFO]: info - Creating an optimized production build...
2022-07-24T16:22:46.523Z [INFO]: info - Compiled successfully
info - Collecting page data...
2022-07-24T16:22:49.643Z [INFO]: info - Generating static pages (0/17)
2022-07-24T16:22:51.264Z [INFO]: info - Generating static pages (4/17)
2022-07-24T16:22:52.217Z [INFO]: info - Generating static pages (8/17)
2022-07-24T16:22:52.897Z [INFO]: info - Generating static pages (12/17)
2022-07-24T16:22:53.270Z [INFO]: info - Generating static pages (17/17)
2022-07-24T16:22:53.289Z [INFO]: info - Finalizing page optimization...
2022-07-24T16:22:53.295Z [INFO]:
2022-07-24T16:22:53.312Z [INFO]: Page Size First Load JS
┌ ○ / (936 ms) 19.5 kB 1.04 MB
├ ○ /__workspace 841 B 137 kB
├ ○ /__workspace/[slug] 7.35 kB 1.02 MB
├ └ css/17d35c37ffa88498e134.css 931 B
├ ○ /__workspace/[slug]/ideas/[id] (1141 ms) 3.06 kB 1.01 MB
├ ○ /__workspace/[slug]/settings (1171 ms) 828 B 1.02 MB
├ /_app 0 B 132 kB
├ ○ /404 194 B 132 kB
├ λ /api 0 B 132 kB
├ λ /api/auth/[...nextauth] 0 B 132 kB
├ λ /api/aws 0 B 132 kB
├ λ /api/aws/upload-url 0 B 132 kB
├ λ /api/invitations/accept 0 B 132 kB
├ λ /api/mailchimp/subscribe 0 B 132 kB
├ λ /api/stripe/webhooks 0 B 132 kB
├ ○ /auth/error 1.1 kB 133 kB
├ λ /auth/login 6.25 kB 138 kB
├ ○ /auth/verify-request (1383 ms) 4.32 kB 136 kB
├ ● /blog (ISR: 10 Seconds) (836 ms) 602 B 167 kB
├ ● /blog/[pageId] 607 B 167 kB
├ ○ /check-mailbox (1145 ms) 485 B 133 kB
├ ○ /get-started (1209 ms) 695 B 133 kB
├ ● /legal (ISR: 10 Seconds) (335 ms) 7.25 kB 174 kB
├ ● /manifesto (ISR: 10 Seconds) 7.25 kB 174 kB
├ ● /privacy (ISR: 10 Seconds) (410 ms) 8.18 kB 140 kB
└ ○ /signup 3.08 kB 135 kB
+ First Load JS shared by all 132 kB
├ chunks/framework.6c6eb0.js 42.4 kB
├ chunks/main.0e3f4e.js 27.3 kB
├ chunks/pages/_app.57bd43.js 61.5 kB
├ chunks/webpack.613fd8.js 886 B
└ css/d0eac759b9443d90c7a5.css 10.2 kB
2022-07-24T16:22:53.313Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2022-07-24T16:22:53.574Z [INFO]: Done in 67.83s.
2022-07-24T16:22:53.579Z [INFO]: Starting SSR Build...
2022-07-24T16:26:29.514Z [ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
error - ESLint must be installed in order to run during builds: yarn add --dev eslint
Duplicate atom key "currentUserFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectIdState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectSlugState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
> Build error occurred
Error: Build optimization failed: found pages without a React Component as default export in
pages/blog/[pageId]
pages/privacy
pages/blog
pages/legal
pages/manifesto
See https://nextjs.org/docs/messages/page-without-valid-component for more info.
at /codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:674:19
at async Span.traceAsyncFn (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:77:25)
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...
at makeError (/root/.//node_modules/execa/lib/error.js:60:11)
at handlePromise (/root/.//node_modules/execa/index.js:118:26)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Builder.build (/root/.//node_modules/@sls-next/lambda-at-edge/dist/build.js:377:13)
at async NextjsComponent.build (/root/.//node_modules/@sls-next/-component/dist/component.js:165:13)
at async NextjsComponent.default (/root/.//node_modules/@sls-next/-component/dist/component.js:22:13)
at async fn (/root/.npm/_npx/5241/lib/node_modules//node_modules/@/template/utils.js:280:41)
at async Promise.all (index 0)
at async executeGraph (/root/.npm/_npx/5241/lib/node_modules//node_modules/@/template/utils.js:294:3)
at async Template.default (/root/.npm/_npx/5241/lib/node_modules//node_modules/@/template/.js:67:38)
at async Object.runComponents (/root/.npm/_npx/5241/lib/node_modules//node_modules/@/cli/src/index.js:222:17) {
shortMessage: 'Command failed with exit code 1: node_modules/.bin/next build',
command: 'node_modules/.bin/next build',
escapedCommand: '"node_modules/.bin/next" build',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: 'info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5\n' +
'info - Checking validity of types...\n' +
'info - Creating an optimized production build...\n' +
'info - Compiled successfully\n' +
'info - Collecting page data...',
stderr: 'error - ESLint must be installed in order to run during builds: yarn add --dev eslint\n' +
'Duplicate atom key "currentUserFetch". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "currentUserState". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "currentUserFetch". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "currentUserState". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "projectIdState". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "projectSlugState". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "projectFetch". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'Duplicate atom key "projectState". This is a FATAL ERROR in\n' +
' production. But it is safe to ignore this warning if it occurred because of\n' +
' hot module replacement.\n' +
'\n' +
'> Build error occurred\n' +
'Error: Build optimization failed: found pages without a React Component as default export in \n' +
'pages/blog/[pageId]\n' +
'pages/privacy\n' +
'pages/blog\n' +
'pages/legal\n' +
'pages/manifesto\n' +
'\n' +
'See https://nextjs.org/docs/messages/page-without-valid-component for more info.\n' +
'\n' +
' at /codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:674:19\n' +
' at async Span.traceAsyncFn (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/telemetry/trace/trace.js:60:20)\n' +
' at async Object.build [as default] (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:77:25)',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
2022-07-24T16:26:29.516Z [ERROR]: [?25h
148s › dqjh6lcvjv24j › Error: Command failed with exit code 1: node_modules/.bin/next build
error - ESLint must be installed in order to run during builds: yarn add --dev eslint
Duplicate atom key "currentUserFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "currentUserState__withFallback". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectIdState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectSlugState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectFetch". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
Duplicate atom key "projectState". This is a FATAL ERROR in
production. But it is safe to ignore this warning if it occurred because of
hot module replacement.
> Build error occurred
Error: Build optimization failed: found pages without a React Component as default export in
pages/blog/[pageId]
pages/privacy
pages/blog
pages/legal
pages/manifesto
See https://nextjs.org/docs/messages/page-without-valid-component for more info.
at /codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:674:19
at async Span.traceAsyncFn (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/codebuild/output/src175539022/src/homeofopensource/node_modules/next/dist/build/index.js:77:25)
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...
[?25h
Terminating logging...
```

My Nextjs App structure:

--pages
--->_app(recoil, react router, SSR)
--->api(ISR)
--->blog(ISR)
------>[pageId](SSG)
--->legal(ISR)
--->privacy(ISR)
--->manifesto(ISR)

The reported pages that seam to lead to this error are the ISR pages.
They are using getStaticProps of Nextjs to load data from a Notion CMS. The files look all similar like that one:

```import Layout from "../../client/components/00_Marketing/Layout";

import { ExtendedRecordMap } from "notion-types";

import NotionPage from "../../client/components/00_Marketing/NotionPage";
import { legalPageId } from "../../client/notion/config";
import notion from "../../client/notion/notion";

export const getStaticProps = async () => {
const pageId = legalPageId;
const recordMap = await notion.getPage(pageId);

return {
props: {
recordMap,
},
revalidate: 10,
};
};

export default function LegalPage({
recordMap,
}: {
recordMap: ExtendedRecordMap;
}) {
return (
<>




);
}
```

### Expected behavior

I expected the deployment to just work with the package.json.

### Reproduction steps

I followed the instructions on that website:
[https://docs.amplify.aws/guides/hosting/nextjs/q/platform/js/#getting-started-1](url)

I added the environmental variable AMPLIFY_NEXTJS_EXPERIMENTAL_TRACE = true
image

### Build Settings

```yaml
`version: 1
backend:
phases:
# IMPORTANT - Please verify your build commands
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install

build:
commands:
- yarn run build
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
`
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the reported Amplify Hosting build settings and the frontend build commands, especially `yarn run build` for the Next.js SSR, SSG, and ISR deployment. Identify the complete frontend error after the truncated log and compare it with a deployment using SSR alone; done means the hybrid deployment completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js
Domain
build-system, ci-cd, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.