500 error when fetch

System Information
  • Strapi Version: 3.6.9
  • Operating System: Windows
  • Database: SQLite
  • Node Version: 14.17.0
  • NPM Version: 7.11.1
  • Yarn Version: n/a

I have a content type that currently has 998 entries. When I fetch with api, I never had any issue until today system gives me this error:

Error:select distinct upload_file_morph.* from upload_file_morph where field = “pet_photo” and upload_file_morph.related_id in (1, 2, 3, … ,998) and upload_file_morph.related_type = ”customers_and_pets” - SQLITE_ERROR: too many SQL variables

Anyone got any ideas how to solve this?

Steps to recreate this issue:

  1. create a content-type
  2. create 1 entry in it
  3. fetch with api and make sure it works
  4. create 998 entries in it
  5. fetch again with fetch(URL/CONTENT_TYPE?_limit=-1)