The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions

I am getting the below error when running
serverless deploy function -f myFunction

I have also updated the node version in the serverless.yml:

provider:
  name: aws
  runtime: nodejs10.x
  stage: dev
  region: eu-west-2

And also in .babelrc:
{
“plugins”: [“source-map-support”, “transform-runtime”],
“presets”: [
[“env”, { “node”: “10.14.1” }],
“stage-3”
]
}

 Serverless Error ---------------------------------------

  ServerlessError: The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions.
      at promise.catch.err (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:331:27)
      at process._tickCallback (internal/process/next_tick.js:68:7)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              10.14.1
     Framework Version:         1.66.0
     Plugin Version:            3.5.0
     SDK Version:               2.3.0
     Components Version:        2.22.3

~/code/jsa-app-api$ node --version
v10.14.1

Here is my package.json:

{
  "name": "jsa-app-api",
  "version": "1.1.0",
  "description": "A Node.js starter for the Serverless Framework with async/await and unit test support",
  "main": "handler.js",
  "scripts": {
    "start": "./node_modules/.bin/serverless offline -s dev",
    "debug": "SET SLS_DEBUG=* && node --inspect=4000 %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\serverless\\bin\\serverless offline -s dev",
    "test": "jest"
  },
  "author": "",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/AnomalyInnovations/serverless-nodejs-starter.git"
  },
  "devDependencies": {
    "aws-sdk": "^2.404.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-source-map-support": "^1.0.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-3": "^6.24.1",
    "jest": "^24.8.0",
    "serverless-offline": "^3.25.6",
    "serverless-webpack": "^5.1.0",
    "webpack": "^4.16.2",
    "webpack-node-externals": "^1.6.0"
  },
  "dependencies": {
    "babel-runtime": "^6.26.0",
    "request": "^2.88.0",
    "request-promise-native": "^1.0.7",
    "serverless-dotenv-plugin": "^2.1.1",
    "serverless-nested-stack": "0.0.7",
    "serverless-offline-lambda": "^1.0.6",
    "serverless-plugin-split-stacks": "^1.7.2",
    "soap": "^0.26.0",
    "source-map-support": "^0.4.18",
    "truelayer-client": "^1.0.9",
    "uuid": "^3.3.2",
    "xml2js": "^0.4.19",
    "xmlbuilder": "^11.0.0"
  }
}

Can you point me in the right direction please?

1 Like

Hi. I ran into the same issue. I had to change my serverless.yaml:
runtime: nodejs12.x

My project also builds within a Docker image before deploying, so I also had to update the node version installed in my container, but for most, this won’t apply.

Hope this helps!