serverless-appsync/serverless-appsync-simulator

TypeError: Cannot read property 'evaluate' of undefined

bahachammakhi opened this issue · 4 comments

Describe the bug
AppSync Simulator: TypeError: Cannot read property 'evaluate' of undefined.

image
Iam learning a serverless framework right now so I used a start template and added appsync-simulator on it , thank you for your time guys.

This is my serverless.yml file

service:
  name: ${self:custom.serviceName}-backend


plugins:
  - serverless-webpack
  - serverless-appsync-plugin
  - serverless-pseudo-parameters
  - serverless-plugin-aws-alerts
  - serverless-deployment-bucket
  - serverless-appsync-simulator
  - serverless-offline

# The `provider` block defines where your service will be deployed
provider:
  name: aws
  runtime: nodejs12.x
  region: us-east-1
  stage: dev
  memorySize: ${self:custom.env.lambdaMemorySize.${self:provider.stage}, self:custom.env.lambdaMemorySize.default} # optional, in MB, default is 1024
  timeout: ${self:custom.env.lambdaTimeout.${self:provider.stage}, self:custom.env.lambdaTimeout.default} # optional, in seconds, default is 6
  versionFunctions: false # optional, default is true
  logRetentionInDays: 14 # Set the default RetentionInDays for a CloudWatch LogGroup
  deploymentBucket:
    name: ${self:custom.serviceName}-${self:provider.stage}-deploys
    serverSideEncryption: AES256
  apiGateway:
    binaryMediaTypes:
      - "*/*"

package:
  individually: true
  excludeDevDependencies: true
  
custom:
  appsync-simulator: # appsync-offline configuration
    location: ".webpack/service/src" # use webpack build directory
  env:
    appSyncLogLevel:
      dev: ERROR
      stage: ERROR
      prod: ERROR
      default: ALL
    # for some reason pseudo-parameter #{AWS::AccountId} does not work ${file(../serverless.yml):custom.name}
    lambdaMemorySize:
      dev: 256
      stage: 256
      prod: 512
      default: 128
    lambdaTimeout:
      dev: 6
      stage: 6
      prod: 8
      default: 4
    accountId:
      prod: xxxxxxxxxxxxx # TODO: change xxxxxxxxxxxxx to your prod accountId
      default: xxxxxxxxxxxxx # TODO: change xxxxxxxxxxxxx to your accountId
  region: "${self:provider.region}"
  accountId: ${self:custom.env.accountId.${self:provider.stage}, self:custom.env.accountId.default}
  serviceName: "xxx" # TODO: change xxx to your name
  name: "${self:service.name}-${self:provider.stage}"
  nameU: "${self:custom.serviceName}_backend_${self:provider.stage}"
  appSync: # appsync plugin configuration
    name: "smart-business-appsync"
    authenticationType: API_KEY
    serviceRole: "AppSyncServiceRole"
    dataSources: ${file(api/appsync/datasources.yml)}
    mappingTemplates: ${file(api/appsync/mappings.yml)}
   webpack:
     includeModules:
       forceInclude:
         - source-map-support
       forceExclude:
        - aws-sdk


functions: ${file(resources/lambda-functions.yml)}

# Create resources with separate CloudFormation templates
resources: ${file(resources/resources.yml)}

@bahachammakhi We are also face the same issue on windows. Are you able to find solution to this?

@appdatasoft no solution till now waiting for the maintainer to respond .

Sorry Guys, I missed this somehow.

I suspect the error comes from the cfn-resolver-lib dependency.
It is hard to tell where exactly, though, there are several evaluate methods.

It is probably a resource in your resources resources.yml file.

Would you be able to debug and pinpoint the exact line that throws the error?

It either requires a fix in the aforementioned package or you should pre-resolve it in your serverless file

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.