Knex querybuilder throws exceptions

System Information
  • Strapi Version: 4.11.1
  • Operating System: Windows Server 2016
  • Database: SQLite3
  • Node Version: v14.19.0
  • NPM Version: 6.14.16
  • Yarn Version: NA

My code calls findMany() method like this:

const tenMinAgo = new Date(now.getTime() - 10 * oneMinute);
const sevenDaysAgo = new Date(now.getTime() - (10 + 60 * 24 * 7) * oneMinute);
await strapi.entityService.findMany(
      '', {
        filters: {
          $and: [
            {isGoodd: false},
            {createdAt: {$between: [sevenDaysAgo, tenMinAgo]}}

Strapi itself does not complain, but I get an uncaught error from it:

(node:315636) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: You must specify 2 values for the whereBetween clause, debug: column: [t0.created_at], values: []
    at QueryBuilder_SQLite3.whereBetween (.\server\node_modules\knex\lib\query\querybuilder.js:647:5)
    at applyOperator (.\server\node_modules\@strapi\database\lib\query\helpers\where.js:240:10)
    at .\server\node_modules\@strapi\database\lib\query\helpers\where.js:301:5
    at Array.forEach (<anonymous>)
    at applyWhereToColumn (.\server\node_modules\@strapi\database\lib\query\helpers\where.js:298:28)
    at .\server\node_modules\@strapi\database\lib\query\helpers\where.js:333:5
    at Array.forEach (<anonymous>)
    at applyWhere (.\server\node_modules\@strapi\database\lib\query\helpers\where.js:314:22)
    at .\server\node_modules\@strapi\database\lib\query\helpers\where.js:319:30
    at Array.forEach (<anonymous>)
(node:315636) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see (rejection id: 4)

Would it be possible that sevenDaysAgo and tenMinAgo are empty, which leads to this error? Seems no, I console.log()ed them, they do have valid values like below:

[2023-06-28T17:00:00+08:00] tenMinAgo: Wed Jun 28 2023 16:50:00, sevenDaysAgo: Wed Jun 21 2023 16:50:00

Any thoughts?