Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred: CustomDashresourceDashexistingDashcupLambdaFunction - Resource handler returned message: "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." #12054

Closed
4 tasks done
aryakrishn opened this issue Jul 6, 2023 · 4 comments

Comments

@aryakrishn
Copy link

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest v3 release?

  • Yes, I'm using the latest v3 release

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

Getting error on deploying the code.

An error occurred: CustomDashresourceDashexistingDashcupLambdaFunction - Resource handler returned message: "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.

The run time is set to nodejs18.x as in the attached serverless.yml format.

This error is happening when I add cognitoUserPool event to the function. Without it deployment works.

Service configuration (serverless.yml) content

service: app-backend

plugins:
  - serverless-dotenv-plugin
  - serverless-prune-plugin

custom:
  dotenv:
    variableExpansion: false
  prune:
    automatic: true
    number: 5
      
frameworkVersion: '2'
useDotenv: true

provider:
  name: aws
  runtime: nodejs18.x
  lambdaHashingVersion: 20200924

functions:
business-user-create:
    handler: handler.user.message
    events:
      - http:
          path: /user/message
          method: post
          cors: true
      - cognitoUserPool:
          pool: ${env:COGNITO_POOL_NAME}
          trigger: PostConfirmation
          existing: true
          forceDeploy: true

Command name and used flags

serverless deploy

Command output

Serverless Error ----------------------------------------
 
  An error occurred: CustomDashresourceDashexistingDashcupLambdaFunction - Resource handler returned message: "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. "

Environment information

serverless --version

Framework Core: 3.33.0
Plugin: 6.2.3
SDK: 4.3.2
@AlexMaguey
Copy link

This is because AWS deprecated the node v12 runtime for lambda. I've already sent the PR fixing this.

@Danwakeem
Copy link
Contributor

Thank you @aryakrishn for reporting and @AlexMaguey for the fix.

@aryakrishn it is important to note this has been addressed in the most recent version of framework v3.330 but we have also applied the fix to v2.72.4 incase there is a reason you are unable to upgrade to v3.

@vijay-ashok
Copy link

vijay-ashok commented Oct 23, 2023

Hi, I'm using a old version of serverless framework (1.67.0) and I don't wanna upgrade right now to get the fix (because of migration efforts from v1 to v3). Could anyone please help me how to fix this issue in my case with my current version itself?

Here is the error log from serverless
ServerlessError: An error occurred: CustomDashresourceDashapigwDashcwDashroleLambdaFunction - Resource handler returned message: "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. (Service: Lambda, Status Code: 400, Request ID: 2b959d10-63f7-46f4-9970-478ae23f02da)" (RequestToken: 3304965f-8771-b869-a8c6-2d2751fa3deb, HandlerErrorCode: InvalidRequest).

@danmana
Copy link

danmana commented Oct 25, 2023

@vijay-ashok we had a similar issue, and used this approach with v1.* framework

Use the solution from here: #11337 (comment)

  • replace let key = 'CustomDashresourceDashexistingDashs3LambdaFunction' with the function that fails for you CustomDashresourceDashapigwDashcwDashroleLambdaFunction
  • add this to your serverless.yml
plugins:
  - ./.serverless_plugins/lambda-update-deprecated-runtime.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants