sid88in / serverless-appsync-plugin

serverless plugin for appsync
MIT License
951 stars 189 forks source link

TypeError: Cannot read properties of undefined (reading 'schema') #596

Closed nileshdev0707 closed 1 year ago

nileshdev0707 commented 1 year ago

TypeError: Cannot read properties of undefined (reading 'schema')

i am getting this error this is my yml file

org: appsh
app: backend
service: graphQlApi
plugins:
  - serverless-appsync-plugin
environment:
  SHIPMENTS_TABLE: shipmentsfff

provider:
  name: aws
  runtime: nodejs16.x

custom:
  appSync:
    name: app-graphql
    schema:
      - 'schema.graphql'
    authenticationType: AMAZON_COGNITO_USER_POOLS
    caching:
      behavior: FULL_REQUEST_CACHING # or PER_RESOLVER_CACHING. Required
      ttl: 3600
      type: 'T2_SMALL'
    userPoolConfig:
      defaultAction: ALLOW
      userPoolId: sdsadsadsadsadTest
    dataSources:
      - type: AMAZON_DYNAMODB
        name: app-datasource
        config:
          tableName: ss_tavv
    pipelineFunctions:
      ListShipmentsFunction:
        dataSource: app-datasource
        code: listShipments.js
    mappingTemplates:
      - dataSource: app-datasource
        type: Query
        field: listApp
        functions: # array of functions if kind === 'PIPELINE'
          - ListShipmentsFunction

schema.graphql` on the root

    listApp(filter: TableShipmentsDevFilterInput, limit: Int, nextToken: String): ShipmentsDevConnection

type ShipmentsDev {
    company_id: String
    primaryKey: ID
    sortKey: String
   }

   ...........
danielfttorres commented 1 year ago

@nileshdev0707 for the v2+ of serverless-appsync-plugin you don't need custom property.

In your serverless.yml:

# use this
...
appSync:
  ...

# instead of this
...
custom:
  appSync:
    ...