user9847788
user9847788

Reputation: 2443

How to resolve ApiLambdaFunction error using serverless to deploy Angular app to AWS

I am trying to deploy my Angular app to AWS using the serverless package, following the steps in this tutorial.

I've followed the steps correctly, & ran npm run build:serverless:deploy, but rather than the app being successfully deployed I get the following error message in the console:

An error occurred: ApiLambdaFunction - The runtime parameter of nodejs6.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs10.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: dba0ade8-1f2c-4dc7-8ddc-c2966a54a67c).

When I run node -v in my command line, I see that it's version 10.14.1.

However, I did find the following nodejs6.10 reference in serverless.yml:

provider:
  name: aws
  runtime: nodejs6.10
  memorySize: 192
  timeout: 10
  stage: production
  region: eu-central-1

Can someone please tell me why this is occurring & how to resolve it?

Upvotes: 2

Views: 3111

Answers (1)

Thales Minussi
Thales Minussi

Reputation: 7235

The reason it happens is that you are trying to set the Node.js version running in your Lambda function to Node.js 6 and this is no longer supported.

Change your serverless.yml file to

provider:
  name: aws
  runtime: nodejs10.x
  memorySize: 192
  timeout: 10
  stage: production
  region: eu-central-1

The error message is pretty clear though. AWS has discontinued the support for Node.js 6 one or two months ago. Only functions that were originally created in this version will still work. New functions can no longer be created in Node.js 6. Honestly, there isn't a single reason somebody would want to do it anyways.

https://aws.amazon.com/blogs/developer/node-js-6-is-approaching-end-of-life-upgrade-your-aws-lambda-functions-to-the-node-js-10-lts/

Upvotes: 3

Related Questions