How to filter graphql query with strapi

System Information
  • v4.1.8:
  • MacOs:
  • SQL:
  • 12.22.0:
  • 6.14.11:

I’m trying to make a query and filter through the lists based on a field but I get an error
“Unknown argument “filters” on field “Query.blogs”.”

query GetBlog {
  blogs(filters: {slug: { eq: "test"}}) {
    data {

Any help would be appreciated, thanks

1 Like

Same problem here.
It just allows sorting but not filtering.

Yeah same issue I’m having here, only allows sorts and I don’t want to use fetch a single item by id

Found this:

In /home/yoyo/Documents/my-strapi/node_modules/@strapi/plugin-graphql/server/services/content-api/index.js there is a call to pruneSchema from @graphql-tools/utils package which leaves only the sort argument in the generated content type schemas. It seems that this happens with the latest version 8.6.8 of @graphql-tools/utils. If we force the version 8.6.7 the schemas are generated correctly. I added this in the package.json

"resolutions": { "@graphql-tools/utils": "8.6.7" }

This did not regenerate the filters. Still looking for a solution. :slight_smile:


forum won’t let me edit my post anymore.

I was able to get this solution to work.
I had to yarn cache clear
I may have also had to delete yarn.lock and run yarn install, but I’m not sure if that was necessary.

1 Like

This worked for me as well, I had to add it as a dependency but all good now, thanks for this