Error while deploying a serverless application. "This.serverless.variables.populateObject" is not a function.

Context:

My team has been developing a data lake in AWS in nodejs (14.xx) and deploying the resources with serverless (2.xx).

Severless V2 is using Node12.xx by default to create and update lambda function and this node version has been deprecated by AWS. So we have to upgrade our Serverless and Node version.

Error:

After updating the framework I have be facing this block when deploying my serverless application sing my “feed-dev” stack:

The error message indicates a “TypeError,” specifically stating that **“this.serverless.variables.populateObject” ** is not a function.

Error Type: TypeError
This is a JavaScript error that occurs when you attempt to use a value as a different data type than what it actually is.

Location: C:\Source\pariveda-datalake-sls\feed\node_modules\serverless-step-functions\lib\yamlParser.js:26:62
The error is happening in the “yamlParser.js” file, specifically at line 26, and column 62.

**About my environment: **

Environment: win32, node 16.16.0, framework 3.33.0 (local) 3.32.2v (global), plugin 6.2.3, SDK 4.3.2

My local nodejs version is v18.17.0 (node -v)

I reduced my serverless.yaml to the minimum:

service: feed

plugins:
  - serverless-step-functions
  - serverless-webpack
  # - serverless-plugin-thundra

provider:
  name: aws
  runtime: nodejs14.x
  stage: ${env:STAGE, opt:stage, 'dev'}
  region: ${env:REGION, opt:region, 'us-east-2'}
 
environment:
  REGION: ${self:provider.region}
  API_GATEWAY_ID: !ImportValue  exIngestGateway-ApiId-${self:provider.stage}
  API_GATEWAY_KEY: ${ssm:/API_GATEWAY_KEY}

custom:
  webpack:
    includeModules: true
    excludeFiles: src/**/*.test.[t|j]s
  thundra:
    disable: ${strToBool(${opt:thundraOff, 'true'})}

The problem seems to be baked in the step function plugin I don’t know how to solve it,

1 Like

Hi
Same error here. Did you understand how to solve it?

Fabio

Hi, I have upgraded to serverless v3, same issue , reason: serverless.variables.populateService is not a function. Have you found a workaround ?