Error using securityGroupId

Hi

I’m getting the following exception when try to deploy a function from my project:

TypeError: Cannot read property 'securityGroupIds' of undefined
    at AwsDeployFunction.updateFunctionConfiguration (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deployFunction\index.js:135:58)
From previous event:
    at Object.deploy:function:deploy [as hook] (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deployFunction\index.js:39:10)
    at BbPromise.reduce (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:358:55)
From previous event:
    at PluginManager.invoke (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:358:22)
    at PluginManager.run (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:389:17)
    at variables.populateService.then (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:99:33)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
    at Serverless.run (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:86:74)
    at serverless.init.then (C:\Users\adm\AppData\Roaming\npm\node_modules\serverless\bin\serverless:39:50)

The serverless.yml structure wasnt changed and the full project deploy/remove works fine. My project structure is the following:

/…
/src/
/environment/
/lib/
serverless.yml

Inside the enviroment directory I created a file containg the security group and subnet configuration for production and development and inside the serverless.yml the following structure was created:

provider:
  name: aws
  runtime: nodejs6.10
  custom:
    stage: ${opt:stage}
    profile: ${self:provider.${opt:stage}.profile}
  production:
    services: ${file(./environment/production/services.yml)}
    vpc: ${file(./environment/production/vpc.yml)}
    profile: production
  development:
    services: ${file(./environment/development/services.yml)}
    vpc: ${file(./environment/development/vpc.yml)}
    profile: development
  aliases:
    - &vpc
      ${self:provider.${opt:stage}.vpc}
  environment: ${self:provider.${opt:stage}.services}
  apiKeys:
    - newclube-${opt:stage}-key
  memorySize: 128
  vpc:
    << : *vpc

I didnt find anything regarding this error.

Please, I need help to fix this error.

Thanks!

In 1.18 version the deploy function command works fine. This error is happing at version 1.22.

Try going back to 1.21. I tried to install 1.22 this afternoon and it seems a little unstable.