MrHertal/react-admin-amplify

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

Closed this issue · 0 comments

There was an error using filter using query. When I submit the code, "TypeError: Cannot read properties of undefined (reading 'nextToken')" error occured. What's the problem?

  • Schema
type B2BProduct
  @model
  @auth(
    rules: [
      { allow: public, operations: [create, update, delete, read] }
      { allow: groups, groups: ["user", "adminUser"] }
    ]
  )
  @key(name: "byCode", fields: ["code", "id"], queryField: "B2BProductsByCode") {
  id: ID!
  thumbImage: S3Object!
  price: Int!
  productOption: [Option]!
  quantity: Int!
  eventText: String
  code: Int!
  is_del: Int!
  user_id: String!
  product_id: String!
}

  • queries
export const b2BProductsByCode = /* GraphQL */ `
  query B2BProductsByCode(
    $code: Int
    $id: ModelIDKeyConditionInput
    $sortDirection: ModelSortDirection
    $filter: ModelB2BProductFilterInput
    $limit: Int
    $nextToken: String
  ) {
    B2BProductsByCode(
      code: $code
      id: $id
      sortDirection: $sortDirection
      filter: $filter
      limit: $limit
      nextToken: $nextToken
    ) {
      items {
        id
        thumbImage {
          bucket
          region
          key
        }
        price
        productOption {
          name
          contents {
            name
            contents {
              name
              contents {
                name
              }
            }
          }
        }
        quantity
        eventText
        code
        is_del
        user_id
        product_id
        createdAt
        updatedAt
      }
      nextToken
    }
  }
`;