-
I have the following query, which works fine in nitro and returns the expected result: query DocumentQuery{
documents(order: [ {
partnerName: ASC
}],
skip: 0,
take: 10,
where: {
or: [
{
description: {
contains: "test"
},
}
]
}){
totalCount,
items {
id,
number,
description,
partnerName,
createdAt
}
},
} But, when using this query in Apollo Vue Client (https://apollo.vuejs.org), the Hot Chocolate server returns "HC0047". Non working example: const { loading, onError, onResult, load } = useLazyQuery<DocumentQuery>(
gql`
query DocumentQuery($order: [DocumentQueryDtoSortInput!], $skip: Int!, $take: Int!, $where: DocumentQueryDtoFilterInput) {
documents(order: $order, skip: $skip, take: $take, where: $where) {
items {
id,
number,
description,
partnerName,
createdAt
},
totalCount
}
}
`, () => ({
order: [getOrderBy.value],
skip: (pagination.value.page - 1) * pagination.value.rowsPerPage,
take: pagination.value.rowsPerPage,
where: filterOptions.value
})
); On the other hand, when removing the "where" from the query above, like this: it works! const { loading, onError, onResult, load } = useLazyQuery<DocumentQuery>(
gql`
query DocumentQuery($order: [DocumentQueryDtoSortInput!], $skip: Int!, $take: Int!) {
documents(order: $order, skip: $skip, take: $take) {
items {
id,
number,
description,
partnerName,
createdAt
},
totalCount
}
}
`, () => ({
order: [getOrderBy.value],
skip: (pagination.value.page - 1) * pagination.value.rowsPerPage,
take: pagination.value.rowsPerPage
})
); Also, looking at the above screenshots while debugging the hc GraphQL context, you can see that the variables are not available on the "context" level, but only on the request level in the non working example, but in the working example they are on the "context" level. What am I doing wrong here? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I am having the same error "HC0047" using Nitro and variables this way: query DocumentQuery($where: DocumentQueryDtoFilterInput){
documents(order: [ {
partnerName: ASC
}],
skip: 0,
take: 10,
where: $where){
totalCount,
items {
id,
number,
description,
partnerName,
createdAt
}
},
} // Vars {
"where" : {
"or": [
{
"description": {
"contains": "test"
}
}
]
}
} |
Beta Was this translation helpful? Give feedback.
-
Maybe it helps:
But read https://chillicream.com/docs/hotchocolate/v14/security/cost-analysis#applying-a-cost-weight before disable cost limits. |
Beta Was this translation helpful? Give feedback.
-
Resolved the issue using "FilterInputType", see https://chillicream.com/docs/hotchocolate/v14/fetching-data/filtering |
Beta Was this translation helpful? Give feedback.
Resolved the issue using "FilterInputType", see https://chillicream.com/docs/hotchocolate/v14/fetching-data/filtering
It looks like I need to narrow down the props that can be used for filtering and ordering.