I currently have a persisted endpoint that is meant to allow for paging over a list of content fragments:
/graphql/execute.json/xxx/getSomeContentFragmentPaginated;startRecord=0;numberOfRecords=3
The underlying GraphQL query looks something like this:
query getSomeContentFragmentPaginated($startRecord: Int, $numberOfRecords: Int)
{
someContentFragmentList(offset: $startRecord, limit: $numberOfRecords) {
items {
...
}
}
}
From the GraphQL Editor the query is ok - but when accessing it from the rest endpoint I get a casting error:
Variable 'startRecord' has an invalid value: Expected a value that can be converted to type 'Int' but it was a 'String'
Any idea how I convert the incoming String value from the url to Int?
Solved! Go to Solution.
This is a known issue apparently:
" SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters "
Hi @ArnoFourieEDG I tried out hiting the persistent query within the browser and getting the desired result.
Can you share how are you creating the URL for hitting the endpoint URL?
Upon further investigation on both AEM Cloud (v2023.8.13099.20230810t160553z-230702) and AEM 6.5 SP18, found the "String to Int" casting error in the AEM Cloud. Interestingly, the SP18 version executed the persistent query flawlessly without encountering any errors. FYI @ArnoFourieEDG
Update: The query seems to work fine on 2023.7.12874 but not on 2023.8.13206...
Underlying issue seems to be regression testing.
This is a known issue apparently:
" SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters "