Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions #2600

Open
@pomSense

Description

@pomSense

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

  • You have reviewed the README and FAQs, which answers several common questions.
  • 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.
  • You have first tried using the most recent latest or alpha @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 old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions