aws-amplify / aws-amplify/amplify-hosting
Next.js 13 - Branch Builds Failing because of `[ERROR]: !!! CustomerError: Framework Web not supported`, need to manually set the framework
- 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.
- [X] I have removed any sensitive information from my code snippets and submission.
### App Id
diismcemmerqy
### AWS Region
us-east-2
### Amplify Hosting feature
SSR
### Frontend framework
Next.js
### Next.js version
13.4.10
### Next.js router
App Router
### Describe the bug
Duplicate of https://github.com/aws-amplify/amplify-hosting/issues/3649 but it was closed without being resolved.
When deploying a new branch, the branch has framework="web" rather than framework="Next.js - SSR." I have to run the command `aws amplify update-branch ... --framework "Next.js - SSR"` otherwise the build fails.
The package.json in the failing branch is setup for SSR:
```Json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
```
### Expected behavior
The new branch should have framework="Next.js - SSR," not framework="web"
### Reproduction steps
1. With an amplify hosting Next.js project, connect a branch
2. Go to the deployment and view the build fail with error `[ERROR]: !!! CustomerError: Framework Web not supported`
### Build Settings
```yaml
version: 1
applications:
- appRoot: app1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
```
### Log output
```
# Starting phase: preBuild
2023-09-15T17:34:45.278Z [INFO]: # Executing command: npm ci
2023-09-15T17:34:56.812Z [WARNING]: npm
2023-09-15T17:34:56.815Z [WARNING]: WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
2023-09-15T17:35:13.977Z [INFO]: added 1057 packages, and audited 1058 packages in 28s
2023-09-15T17:35:13.979Z [INFO]: 197 packages are looking for funding
run `npm fund` for details
2023-09-15T17:35:13.982Z [INFO]: 3 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
2023-09-15T17:35:14.003Z [INFO]: # Completed phase: preBuild
# Starting phase: build
2023-09-15T17:35:14.004Z [INFO]: # Executing command: npm run build
2023-09-15T17:35:14.346Z [INFO]: > reporting-dashboard@0.1.0 build
> next build
2023-09-15T17:35:14.888Z [INFO]: - warn No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2023-09-15T17:35:14.903Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-09-15T17:35:14.904Z [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
2023-09-15T17:35:15.166Z [INFO]: - info Creating an optimized production build...
2023-09-15T17:35:15.579Z [INFO]: - info Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
2023-09-15T17:35:15.945Z [INFO]: - info Using external babel configuration from /codebuild/output/src2422851127/src/ecosystem/reporting-dashboard/.babelrc
2023-09-15T17:35:23.013Z [WARNING]: Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
2023-09-15T17:35:37.633Z [INFO]: - info Compiled successfully
2023-09-15T17:35:37.638Z [INFO]: - info Linting and checking validity of types...
2023-09-15T17:35:39.473Z [INFO]: ./app/(routes)/(auth)/signin.tsx
42:9 Warning: Using `` could result in slower LCP and higher bandwidth. Consider using `
` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
2023-09-15T17:35:40.899Z [INFO]: - info Collecting page data...
2023-09-15T17:35:41.627Z [INFO]: Using test environment
2023-09-15T17:36:01.054Z [INFO]: - info Generating static pages (0/4)
2023-09-15T17:36:01.098Z [INFO]: - info Generating static pages (1/4)
2023-09-15T17:36:01.145Z [INFO]: - info Generating static pages (2/4)
2023-09-15T17:36:01.232Z [INFO]: - info Generating static pages (3/4)
2023-09-15T17:36:01.338Z [INFO]: - info Generating static pages (4/4)
2023-09-15T17:36:01.356Z [INFO]: - info Finalizing page optimization...
2023-09-15T17:36:01.360Z [INFO]:
2023-09-15T17:36:01.370Z [INFO]: Route (app) Size First Load JS
┌ ○ / 1.73 kB 96.2 kB
├ λ /api/auth/[...nextauth] 0 B 0 B
└ λ /api/mock/auth/token 0 B 0 B
+ First Load JS shared by all 94.5 kB
├ chunks/680-188d39d48febbd99.js 31.5 kB
├ chunks/751-cbca6a2b62b677cf.js 10.5 kB
├ chunks/bce60fc1-82cadbfceb327e35.js 50.5 kB
├ chunks/main-app-7119f71122760ac9.js 215 B
└ chunks/webpack-9ae83196ace93b57.js 1.74 kB
Route (pages) Size First Load JS
─ ○ /404 2.78 kB 85.2 kB
+ First Load JS shared by all 82.4 kB
├ chunks/framework-8883d1e9be70c3da.js 45 kB
├ chunks/main-0f168d41e7afb736.js 34.8 kB
├ chunks/pages/_app-d019a93fac5a4db9.js 850 B
└ chunks/webpack-9ae83196ace93b57.js 1.74 kB
2023-09-15T17:36:01.371Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
2023-09-15T17:36:01.564Z [INFO]: # Completed phase: build
2023-09-15T17:36:01.566Z [INFO]: ## Build completed successfully
2023-09-15T17:36:01.567Z [INFO]: # Starting caching...
2023-09-15T17:36:01.570Z [INFO]: # Creating cache artifact...
2023-09-15T17:36:01.572Z [INFO]: # Created cache artifact
2023-09-15T17:36:01.572Z [INFO]: # Uploading cache artifact...
2023-09-15T17:36:01.625Z [INFO]: # Uploaded cache artifact
2023-09-15T17:36:01.626Z [INFO]: # Caching completed
2023-09-15T17:36:01.629Z [INFO]: # No custom headers found.
2023-09-15T17:36:01.630Z [ERROR]: !!! CustomerError: Framework Web not supported
2023-09-15T17:36:01.631Z [INFO]: # Starting environment caching...
2023-09-15T17:36:01.631Z [INFO]: # Environment caching completed
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.