I’m trying to fetch multiple transactions with an array of IDs but i might do something wrong and i’m facing the following error :
ERROR GraphQL Error: [
{
path: null,
locations: [ [Object] ],
message: "Validation error of type WrongType: argument 'filter.id' with value 'ObjectValue{objectFields=[ObjectField{name='id', value=ObjectValue{objectFields=[ObjectField{name='in', value=VariableReference{name='ids'}}]}}]}' contains a field not in 'ModelIDInput': 'in' @ 'listTransactions'"
}
]
I’m using amplify underthehood.
This is the query i call :
const getTransactionsQuery = gql`
query MyQuery($ids: [ID!]) {
listTransactions(filter: { id: { in: $ids } }, limit: 100000000) {
items {
id
eventId
cycleId
status
}
}
}
`;
And this is the code that make the query :
const getTransactions = async (idList) => {
const headers = {
"x-api-key": "xxxx",
};
const data = {
query: print(getTransactionsQuery),
variables: { id: idList },
};
const graphqlData = await axios.post(
"xxxx",
data,
{
headers: headers,
}
);
if (graphqlData.data.errors) {
console.error("GraphQL Error:", graphqlData.data.errors);
return null;
}
return graphqlData.data;
};
Do you see where my error can come from ?
Thank you a lot
New contributor