"aws-nodejs12.x" is not supported

I’m new to Serverless Framework, coming from a blog post I found a while back:

It led me to cloning git repository thats with that blog, and after removing the .git folder as the readme file says, I try to run
sls create function -f functionName --handler src/functions/fileName.handlerName --path src/test/functions --stage local

I get the following error:
`john@Johns-MacBook-Pro serverless-nodejs-template % sls create function -f functionName --handler src/functions/fileName.handlerName --path src/test/functions --stage local
Serverless: Generating function…

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

Provider / Runtime “aws-nodejs12.x” is not supported. Supported runtimes are: “aws-nodejs4.3”, “aws-nodejs6.10”, “aws-nodejs8.10”.

Get Support --------------------------------------------

Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.16.0
Framework Version: 1.63.0
Plugin Version: 3.3.0
SDK Version: 2.3.0
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
(Removed links as new users can only have 2 links)

I couldn’t find much when googling this error so unsure where its coming from. Any suggestions?

Hello @mcdonnell-john and welcome to the forum!

It looks like this error is thrown by serverless-mocha-plugin. This plugin added support for the Node.js 12.x runtime at the end of November 2019 but does not seem to have released a new version on npm since the end of July 2019.

The example repository you are looking at updated its runtime at the beginning of December 2019, but was previously using an older runtime compatible with serverless-mocha-plugin. My understanding is that, at the time the article was initially published, the command you run was working as expected because it was using this older runtime.

My recommendation would be to change your runtime in your serverless.yml file to be nodejs10.x or nodejs8.10 and to try again.

Hope this helps! :slightly_smiling_face:

Actually, I just realized @garethmcc is the author of the article and the owner of the repository. Maybe you could confirm if my theory is right or not? Thanks in advance! :smile:

I actually forked the original project and released the fork to npm as serverless-mocha not serverless-mocha-plugin


Thanks @teddy-gustiaux and @garethmcc for the information.

I have to admin I was lost, I wouldn’t have guessed that the plugin would effect the serverless runtime, so wasn’t looking into that, more had thought something was mis-configured with my installation of serverless.

It might be useful if we could get a minor change to that repository to change the referenced “serverless-mocha-plugin”: “^1.10.0”,to be “serverless-mocha”: “^1.12.0”,` to avoid others confusion in future?

Thanks again for the information guys! Now to begin my serverless journey :wink:

True, I’ll change that


Thanks for the explanation @garethmcc! :slight_smile:

@mcdonnell-john Hope you have a great time in the world of serverless!