State your question
How to solve error Generic parameter 'Query' could not be inferred when attempting an AppSync fetch?
Which AWS Services are you utilizing?
AWS AppSync, Amplify
Provide code snippets (if applicable)
let allPOQuery = AllProcessOrdersQuery(limit: 20, nextToken: nextToken)
// run query
client?.fetch(query: allPOQuery) { result in
switch result {
case .success(let queryResult):
print("Got query")
case .failure(let error):
print("Error: \(error)")
}
Results in error Generic parameter 'Query' could not be inferred
Environment(please complete the following information):
Device Information (please complete the following information):
Error has been documented on Apollo SDK but using single parameter completion handler does not fix the issue 668
@osandvold302 The version of the Apollo client we forked is well before the 0.13.0 version on which that issue is filed, but the root cause is similar: the fetch completion handler returns a (result, error) tuple, and you are operating on only one parameter, result. See examples in our docs for more detail.
Hope this helps.
That works, not sure why I didn't catch it before :(
Thanks!
Most helpful comment
@osandvold302 The version of the Apollo client we forked is well before the 0.13.0 version on which that issue is filed, but the root cause is similar: the
fetchcompletion handler returns a(result, error)tuple, and you are operating on only one parameter,result. See examples in our docs for more detail.Hope this helps.