I am executing a GraphQL query:
export const userByName = /* GraphQL */ `
query employee(
$first_name: String
$sortDirection: ModelSortDirection
$filter: ModelUserFilterInput
$limit: Int
$nextToken: String
) {
employee(
first_name: $first_name
sortDirection: $sortDirection
filter: $filter
limit: $limit
nextToken: $nextToken
) {
items {
id
employee_type
first_name
last_name
createdAt
updatedAt
}
nextToken
}
}
`;
When I execute this query, I get this error:
sortDirection is not supported for List operations without a Sort key defined.
I am executing this query using this code:
const userInfo = await API.graphql(
graphqlOperation(employee, {
first_name: name,
sortDirection: 'DESC'
})
)
I'm trying to retrieve data, but the above error arises. I have also tried removing sortDirection, but I just get an empty array as a response.