Error with SQLITE_MAX_VARIABLE_NUMBER

System Information
  • Strapi Version: 3.6.8
  • Operating System:
  • Database: sqlite3
  • Node Version:
  • NPM Version:
  • Yarn Version:

I have e-commerce backend (Strapi with sqlite3) with ~10 000 products, each has about 3-4 images.
When I try to get /categories and I got an error :
Error: select distinct upload_file.* from upload_file where upload_file.id in (…)

  • SQLITE_ERROR: too many SQL variables (about 1500 variables)

It was fixed by overriding the controller in categories
const categories = expect strapi.query('categories').find(ctx.query, ['categories', 'image']);
where “categories”, “image” are related entities

the point was not to receive related products