serverless-next.js
serverless-next.js copied to clipboard
InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions
Issue Summary
With the recent deprecation of nodejs 12 for create/update of lambda functions, there seems to be some default setting that is causing below error even when the runtime is set as nodejs14.x
. Is anyone else facing this?
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 (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/protocol/json.js:52:27)
at Request.extractError (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/protocol/rest_json.js:49:8)
at Request.callListeners (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at callNextListener (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at IncomingMessage.onEnd (/Users/pom/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/aws-lambda/node_modules/aws-sdk/lib/event_listeners.js:335:13)
at IncomingMessage.emit (events.js:412:35)
at IncomingMessage.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'InvalidParameterValueException',
time: 2023-07-31T18:28:27.520Z,
requestId: 'cff19338-f555-412a-a491-f60fce310c87',
statusCode: 400,
retryable: false,
retryDelay: 3.660071109674945
}
Actual behavior
When using using runtime:
runtime:
defaultLambda: 'nodejs14.x'
apiLambda: 'nodejs14.x'
imageLambda: 'nodejs14.x'
## OR
runtime: 'nodejs14.x'
it is using nodejs12.x
as the runtime parameter somewhere.
Expected behavior
When setting the runtime to nodejs14.x
, it should set the runtime parameter as nodejs12.x.
Steps to reproduce
- nvm use 14.19.0
- set the runtime to
nodejs14.x
as shown above - run
serverless
command
Screenshots/Code/Configuration/Logs
Here is my yml:
legacyFrontend:
component: '@sls-next/[email protected]' # it is recommended you pin the latest stable version of serverless-next.js
org: myCompany
app: legacy
stage: staging
inputs:
domain:
- 'my.legacy'
- 'myCompany.com'
domainType: 'both'
domainRedirects:
www.legacy.myCompany.com: https://my.legacy.mycompany.com
memory: 1024
runtime:
defaultLambda: 'nodejs14.x'
apiLambda: 'nodejs14.x'
imageLambda: 'nodejs14.x' # Note that the sharp image library is built for Lambda Node.js 14.x, although it will likely work fine on other runtimes
region: us-west-1
bucketName: my-bucket-name-here
I've also tried doing the runtime as a string:
legacyFrontend:
runtime: 'nodejs14.x'
Node version on local is: 14.19.0
Running in Debug mode doesn't provide any clues to me:
DEBUG ─ Deploying bucket my-bucket-name-here in region us-east-1.
DEBUG ─ Checking if bucket my-bucket-name-here exists.
DEBUG ─ Setting acceleration to "true" for bucket my-bucket-name-here.
DEBUG ─ Bucketmy-bucket-name-here was successfully deployed to the us-east-1 region.
DEBUG ─ Starting deployment of lambda zcgizmn-yzfb33a to the us-east-1 region.
DEBUG ─ Syncing role zcgizmn-1rb33sq in region us-east-1.
DEBUG ─ Saved state for role zcgizmn-1rb33sq.
DEBUG ─ Role zcgizmn-1rb33sq was successfully deployed to region us-east-1.
DEBUG ─ Deployed role arn is arn:aws:iam::000000000000:role/zcgizmn-1rb33sq.
DEBUG ─ Packaging lambda code from /Users/pom/Code/legacy/services/frontend/.serverless_nextjs/default-lambda.
DEBUG ─ Uploading zcgizmn-yzfb33a lambda code.
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.
Versions
- OS/Environment: macOS 13.0.1 (22A400)
- @sls-next/serverless-component version: 3.7.0
- Next.js version: "9.3.5"
Checklist
- [x] You have reviewed the README and FAQs, which answers several common questions.
- [x] You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible. As there is only one maintainer (who maintains this in his free time) and thus very limited resources, if you have time, please try to debug the issue a bit yourself if possible.
- [x] You have first tried using the most recent
latest
oralpha
@sls-next/serverless-component
release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.
Hey, any update on this? We're experiencing the same issue with one of our projects in maintenance stage. cc: @lukesday
Hello, I wanted to check if there are any updates on the issue we discussed earlier. It seems like we are facing a similar problem in one of our projects that is currently in the maintenance stage. Just wanted to keep you in the loop about it. cc: @lukesday
In our case the code was being deployed before the config update is applied, which means the runtime update is never applied. In order to rectify this I manually updated the runtime on the lambda functions from within the AWS dashboard.
I am using AWS codebuild to deploy my application and I'm seeing the exact same issue. I'm specifying 'nodejs16.x' as the runtime but the build uses node 12. I tried what @lukesday did above but no dice. Very strange.
@mbaquerizo Same
I'm encountering a similar predicament when leveraging AWS CodeBuild for my application deployment. My specification for the runtime is 'nodejs14.x', however, it seems to revert to node 12 in the build process. I have tried replicating the steps that @lukesday recommended, but it hasn't resolved the issue. This is quite an enigmatic situation that we need to look into.
@tanuj-g have you found any alternate solution? This is blocking our production deployments at the moment. The strange part is that the default value set by @sls-next/aws-lambda seems to be node 10 (im not sure if/how this is used by the serverless-component package): https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/serverless-components/aws-lambda/src/component.ts#L42
The default used by @sls-next/serverless-component is 'nodejs14' e.g. https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/serverless-components/nextjs-component/src/component.ts#L598-L601
Where is 12 coming from?
@mbaquerizo no I haven't the solution yet. This is blocking out production deployments too at this moment
@mbaquerizo no I haven't the solution yet. This is blocking out production deployments too at this moment
@tanuj-g I found a workaround for my case. After deleting the template files in S3 .serverless
folder for my app, the build ran successfully.
Edit: I just realized my build has a sync step to prevent adding new IAM roles. It adds the .serverless folder to s3 after deploying. Every build syncs up with before and after with S3. I guess for some reason having a .serverless file with template containing runtime version 'nodejs12.x' in the local directory prevents serverless components from using the specified runtime from serverless.yml
As a heads up the underlying build mechanism for this library has been deprecated if you are using the components CLI @mbaquerizo @tanuj-g @pomSense.
Given the build machine for this is still hosted by serverless.com but no longer maintained https://github.com/serverless/components/issues/1040 it might be worth looking to re platform if you do have the chance (Possibly to sst or amplify)
Any update on this? We're faced on same issue so that our entire project deployments are stopped.
my error message is below.
[email protected]
@sls-next/[email protected]
InvalidParameterValueException: The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions
Any update on this? We're faced on same issue so that our entire project deployments are stopped.
my error message is below.
[email protected]
@sls-next/[email protected]
InvalidParameterValueException: The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions
I fixed .yml file
runtime: defaultLambda: "nodejs20.x"
and It worked
@Lee-ji-soo I tried the same settings but mine didn't work. Could you give me a sample of your pipeline?
@RaiSaugat
@Lee-ji-soo I tried the same settings but mine didn't work. Could you give me a sample of your pipeline?
If you resize image with lambda function (ex.https://s3.....?width=200) , you should also set "imageLambda" node version to 20.
defaultLambda: 'nodejs20.x'
apiLambda: 'nodejs20.x'
imageLambda: 'nodejs20.x'
my pipeline sample is below
blurblur:
component: '@sls-next/[email protected]'
inputs:
roleArn: 'arn:awsblurblur'
bucketName: 'blurblur'
bucketRegion: 'ap-northeast-2'
cloudfront:
distributionId: 'blurblur'
runtime:
defaultLambda: 'nodejs20.x'
apiLambda: 'nodejs20.x'
imageLambda: 'nodejs20.x'
build:
env:
NEXT_PUBLIC_ENV_NODE: 'production'
For me, the runtime setting only worked when I defined it as follows:
runtime: nodejs20.x
It seemed to ignore when setting each individual lambda version.