Error on deploy after upgrading to v3: TypeError: validate is not a function

I have just upgraded my project to v3 Serverless Framework and running the serverless deploy command crashes every time, even on a brand new project with the hello handler with no plugins etc.

I am running nvm (for running multiple NodeJs versions on Windows) and I wonder if it is connected to that. The issue is not with AWS, it seems that the actual code for SLS itself is erroring:

Environment: win32, node 14.18.1, framework 3.0.1, plugin 6.0.0, SDK 4.3.0

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 (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 cannot find the issue elsewhere. It 100% is not related to plugins.

Update: so far I have tried uninstalling nvm, uninstalling NodeJS, deleting everything in C:\Users\MainPC\AppData\Roaming\npm and re-installing NodeJS v14 from scratch. I get the exact same error. Reverting to v2.72.2 works fine.

Any ideas?

1 Like

Good to know that I am not alone with this issue.

In my case, it only happens in Github Actions. Locally it just works.

The error is totally random, so I have to keep retrying my job until it works…

Hello @rodrigogs - could you share the details about the node version, your OS where this error happens?

I think I can do better.

This is the repository where the “deploy” job fails with this error from time to time: GitHub - rodrigogs/juquinha

If you fork it and run github actions, you should eventually see the error. Retrying a few times usually solve it.

@rodrigogs, when you say you’re also getting this error, does that mean you are getting the same error message? i.e. TypeError: validate is not a function at ConfigSchemaHandler.validateConfig

@asker yes, but it only happens in the ci. Probably because it always has to install it from scratch, sometimes it works… sometimes not.

One thing that might be influencing it is that I’m using pnpm to manage my npm packages.

@asker please try with v3.1.1. It won’t fix the issue but will print better debug logs. Having that please open an issue at providing all the printed output

1 Like