'Error running Serverless Framework command after upgrading to v3

I recently upgraded my Serverless Framework project from v2.7 to v3.0.1. After doing so, any time I run serverless deploy I get the following error:

Environment: win32, node 14.18.1, framework 3.0.1, plugin 6.0.0, SDK 4.3.0
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
TypeError: validate is not a function
    at ConfigSchemaHandler.validateConfig (C:\Users\MainPC\AppData\Roaming\nvm\v14.18.1\node_modules\serverless\lib\classes\config-schema-handler\index.js:101:5)
    at async Service.validate (C:\Users\MainPC\AppData\Roaming\nvm\v14.18.1\node_modules\serverless\lib\classes\service.js:267:5)
    at async Serverless.run (C:\Users\MainPC\AppData\Roaming\nvm\v14.18.1\node_modules\serverless\lib\serverless.js:162:28)
    at async C:\Users\MainPC\AppData\Roaming\nvm\v14.18.1\node_modules\serverless\scripts\serverless.js:675:9

I have tried the following:

  • Creating a new "hello world" project by running serverless and selecting the NodeJS starter project
  • Uninstalling nvm and re-installing NodeJS v14.18.1 completely
  • Deleted every globally installed NPM module and re-installed only SLS from scratch

I am now running standalone v14 Node without NVM (on Windows 10) and still the error persists. Reverting to v2.7 resolves the error.

Nobody else seems to be suffering this issue. Can anyone offer some assistance?


For those asking for the template, the error even happens on this demo template that Serverless itself generates for a new project:

service: testing-v3

frameworkVersion: '3'

provider:
  name: aws
  runtime: nodejs14.x

functions:
  hello:
    handler: handler.hello

I am pretty confident the issue is either an installation issue or something specific to v3, or both.



Solution 1:[1]

You have to follow some rules to upgrade your versions to v3, Serverless Framework v3 contains breaking changes that may impact projects. In my opinion will be impacted a lot of projects. some of the issues are:

  • frameworkVersion: '3'

CLI Commands

Will no longer work in v3:

serverless --verbose deploy 

Correct syntax:

serverless deploy --verbose

Service configuration

Deprecated in v2, removed in v3:

service:
    name: my-service

Correct syntax:

service: my-service

I really recommend you to check this https://www.serverless.com/framework/docs/guides/upgrading-v3 has the full guide to support the issues you may have.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 idenardi