aws-amplify / aws-amplify/amplify-hosting
[NextJS] InvalidParameterValueException (parameter of nodejs12.x) while Starting SSR Build
- 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
d1vx5g7p91hfch
### AWS Region
us-east-1
### Amplify Hosting feature
Frontend builds, SSR
### Frontend framework
Next.js
### Next.js version
12.3.4
### Next.js router
Pages Router
### Describe the bug
I was trying to update nextJS to 14.0.1 and couldn't so I reset the commits and versions, but now I can't deploy anymore.
(This is my first report, I don't know if I'm doing it right, please correct me if not)
### Expected behavior
In the "Front End" tab the compilation of the code, and the type verification is done correctly, but after that the SSR Build should also complete, but it does not happen.

### Reproduction steps
I just can't run the deploy.
What I did previously was the following:
1. Remove NextJS from the project
2. Install NextJS 14.0.1
3. Upload changes
4. Seeing that they failed, I tried to roll back the changes (removing next and reinstalling in version 12.3.4)
### Build Settings
```yaml
version: 1
backend:
phases:
build:
comands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
- node -v
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- 'node_modules/**/*'
- '.next/cache/**/*'
```
### Log output
```
2023-11-17T19:02:52.955Z [INFO]: # Executing command: node -v
2023-11-17T19:02:52.958Z [INFO]: v16.19.0
2023-11-17T19:02:52.959Z [INFO]: Starting SSR Build...
2023-11-17T19:05:18.001Z [ERROR]: InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x) while creating or updating functions.
at Object.extractError (/root/./-patch.2/node_modules/aws-sdk/lib/protocol/json.js:80:27)
at Request.extractError (/root/./-patch.2/node_modules/aws-sdk/lib/protocol/rest_json.js:61:8)
at Request.callListeners (/root/./-patch.2/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/root/./-patch.2/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/root/./-patch.2/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/root/./-patch.2/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/root/./-patch.2/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /root/./-patch.2/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/root/./-patch.2/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/root/./-patch.2/node_modules/aws-sdk/lib/request.js:688:12) {
code: 'InvalidParameterValueException',
'[Type]': 'See error.Type for details.',
time: 2023-11-17T19:05:17.942Z,
requestId: '41193a1e-ad7f-4f8d-bdb7-ffe22ec9adb6',
statusCode: 400,
retryable: false,
retryDelay: 60.782903561879856
}
2023-11-17T19:05:18.003Z [ERROR]: [G[?25h[G[J
98s › d1vx5g7p91hfch › InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x) while creating or updating functions.
[G[?25h
Terminating logging...
```
### Additional information
I tried to put _"Amazon Linux:2023"_ in
_App settings => Build settings => Build image settings => Build image_
And it shows all the green ticks, but the changes are not updated on my webpage
## Lambda Functions
Previously I had some lambda functions with runtime Nodejs 12x

Now all my lambda functions have the Nodejs 14x.
## This is my package.json:
```
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"export": "npm run build && next export && mv out _static"
},
"dependencies": {
"@aws-amplify/ui-react": "4.4.1",
"@headlessui/react": "1.7.13",
"@stripe/react-stripe-js": "2.1.0",
"@stripe/stripe-js": "1.54.0",
"@tailwindcss/aspect-ratio": "0.4.2",
"@tailwindcss/forms": "0.5.3",
"@tanstack/match-sorter-utils": "8.8.4",
"@tanstack/react-table": "8.9.3",
"aws-amplify": "5.0.22",
"blurhash": "^2.0.5",
"next": "12.3.4",
"node-fetch": "3.3.1",
"nprogress": "0.2.0",
"rc-slider": "10.1.1",
"react": "18.2.0",
"react-blurhash": "^0.3.0",
"react-dom": "18.2.0",
"react-gesture-responder": "2.1.0",
"react-grid-dnd": "2.1.2",
"react-hook-form": "7.43.8",
"react-select": "5.7.2",
"sharp": "^0.32.6",
"stripe": "12.9.0",
"swiper": "10.2.0",
"use-places-autocomplete": "4.0.0",
"usehooks-ts": "2.9.1"
},
"devDependencies": {
"@types/google.maps": "3.53.0",
"@types/node": "18.15.10",
"@types/nprogress": "0.2.0",
"@types/react": "18.2.8",
"@types/react-dom": "18.0.11",
"@types/react-select": "5.0.1",
"autoprefixer": "10.4.14",
"encoding": "^0.1.13",
"next-transpile-modules": "10.0.0",
"postcss": "8.4.21",
"postcss-import": "15.1.0",
"tailwindcss": "3.3.5",
"typescript": "5.1.3"
},
"cacheDirectories": [
"node_modules/",
".next/cache/"
],
"version": "0.0.0"
}
```
Contributor guide
Research direction
Start with the SSR Build failure in the supplied logs, then inspect the package.json, Amplify build settings, and the listed Lambda function runtimes. Determine why deployment still requests nodejs12.x after the functions were changed to Node.js 14.x; done means the SSR build no longer requests the unsupported runtime and deployment completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, next.js, node.js
- Domain
- backend, build-system, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100