FAIL test/webhooks.e2e-spec.ts
  ● Test suite failed to run

    Cannot find module './varroa-threshold.service' from '../src/varroa/varroa.controller.ts'

    Require stack:
      C:/Users/Nick.Szaunig/OneDrive - EnCry/Documents/VS Code/ApiCore/ApiCore-Backend/src/varroa/varroa.controller.ts
      C:/Users/Nick.Szaunig/OneDrive - EnCry/Documents/VS Code/ApiCore/ApiCore-Backend/src/varroa/varroa.module.ts
      C:/Users/Nick.Szaunig/OneDrive - EnCry/Documents/VS Code/ApiCore/ApiCore-Backend/src/app.module.ts
      utils/create-test-app.ts
      webhooks.e2e-spec.ts

    [0m [90m  8 |[39m [36mimport[39m { [33mUpdateVarroaMeasurementDto[39m } [36mfrom[39m [32m'./dto/update-varroa-measurement.dto'[39m[33m;[39m
     [90m  9 |[39m [36mimport[39m { [33mVarroaService[39m } [36mfrom[39m [32m'./varroa.service'[39m[33m;[39m
    [31m[1m>[22m[39m[90m 10 |[39m [36mimport[39m { [33mVarroaThresholdService[39m } [36mfrom[39m [32m'./varroa-threshold.service'[39m[33m;[39m
     [90m    |[39m [31m[1m^[22m[39m
     [90m 11 |[39m [36mimport[39m { [33mIdempotent[39m } [36mfrom[39m [32m'../common/idempotency/idempotent.decorator'[39m[33m;[39m
     [90m 12 |[39m
     [90m 13 |[39m [33m@[39m[33mApiTags[39m([32m'varroa-measurements'[39m)[0m

      at Resolver._throwModNotFoundError (../node_modules/jest-resolve/build/index.js:895:11)
      at Object.<anonymous> (../src/varroa/varroa.controller.ts:10:1)
      at Object.<anonymous> (../src/varroa/varroa.module.ts:2:1)
      at Object.<anonymous> (../src/app.module.ts:20:1)
      at Object.<anonymous> (utils/create-test-app.ts:6:1)
      at Object.<anonymous> (webhooks.e2e-spec.ts:9:1)

[31m[Nest] 17844  - [39m14/10/2026, 13:53:09 [31m  ERROR[39m [38;5;3m[DomainEventDispatcher] [39m[31mDomain events FAILED, an expired claim used up their attempts: cmv81wj4d001xroijcqgc9y09[39m
FAIL test/domain-event-dispatcher.e2e-spec.ts
  ● Console

    console.log
      ◇ injected env (8) from .env.test // tip: ⌁ auth for agents [www.vestauth.com]

      at _log (../node_modules/dotenv/lib/main.js:131:11)

  ● DomainEventDispatcher (e2e) › two dispatchers in parallel produce exactly one effect per event and handler

    TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

    [0m [90m 109 |[39m     [36mconst[39m d [33m=[39m [36mawait[39m db[33m.[39m$queryRaw[33m<[39m[33munknown[39m[][33m>[39m([33mPrisma[39m[33m.[39msql[32m`SELECT "id","status","availableAt", now() AS n, clock_timestamp() AS c, ("availableAt" <= now()) AS due, pg_backend_pid() AS pid FROM ${name} WHERE ${options.filter}`[39m)[33m;[39m
     [90m 110 |[39m     [90m// eslint-disable-next-line[39m
    [31m[1m>[22m[39m[90m 111 |[39m     require([32m'node:fs'[39m)[33m.[39mappendFileSync(process[33m.[39menv[33m.[39m[33mDBG_LOG[39m [36mas[39m string[33m,[39m [36mnew[39m [33mDate[39m()[33m.[39mtoISOString() [33m+[39m [32m' '[39m [33m+[39m table [33m+[39m [32m' empty claim; rows='[39m [33m+[39m [33mJSON[39m[33m.[39mstringify(d) [33m+[39m [32m'\n'[39m)[33m;[39m
     [90m     |[39m                        [31m[1m^[22m[39m
     [90m 112 |[39m   }
     [90m 113 |[39m   [36mreturn[39m __res[33m;[39m
     [90m 114 |[39m }[0m

      at claimBatch (../src/common/outbox/outbox-claims.ts:111:24)
      at DomainEventDispatcher.runOnce (../src/domain-events/domain-event-dispatcher.ts:69:20)
      at DomainEventDispatcher.drain (../src/domain-events/domain-event-dispatcher.ts:101:23)
          at async Promise.all (index 1)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:211:20)

  ● DomainEventDispatcher (e2e) › hands the handler the stored event and its correlation id

    TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

    [0m [90m 109 |[39m     [36mconst[39m d [33m=[39m [36mawait[39m db[33m.[39m$queryRaw[33m<[39m[33munknown[39m[][33m>[39m([33mPrisma[39m[33m.[39msql[32m`SELECT "id","status","availableAt", now() AS n, clock_timestamp() AS c, ("availableAt" <= now()) AS due, pg_backend_pid() AS pid FROM ${name} WHERE ${options.filter}`[39m)[33m;[39m
     [90m 110 |[39m     [90m// eslint-disable-next-line[39m
    [31m[1m>[22m[39m[90m 111 |[39m     require([32m'node:fs'[39m)[33m.[39mappendFileSync(process[33m.[39menv[33m.[39m[33mDBG_LOG[39m [36mas[39m string[33m,[39m [36mnew[39m [33mDate[39m()[33m.[39mtoISOString() [33m+[39m [32m' '[39m [33m+[39m table [33m+[39m [32m' empty claim; rows='[39m [33m+[39m [33mJSON[39m[33m.[39mstringify(d) [33m+[39m [32m'\n'[39m)[33m;[39m
     [90m     |[39m                        [31m[1m^[22m[39m
     [90m 112 |[39m   }
     [90m 113 |[39m   [36mreturn[39m __res[33m;[39m
     [90m 114 |[39m }[0m

      at claimBatch (../src/common/outbox/outbox-claims.ts:111:24)
      at DomainEventDispatcher.runOnce (../src/domain-events/domain-event-dispatcher.ts:69:20)
      at DomainEventDispatcher.drain (../src/domain-events/domain-event-dispatcher.ts:101:23)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:245:5)

  ● DomainEventDispatcher (e2e) › a stale release that ends in FAILED also fails the open deliveries

    expect(received).resolves.toBe()

    Received promise rejected instead of resolved
    Rejected to value: [TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined]

    [0m [90m 320 |[39m       deliveries[33m:[39m [{ handler[33m:[39m [32m'test.counter'[39m[33m,[39m status[33m:[39m [32m'FAILED'[39m[33m,[39m attempts[33m:[39m [35m7[39m }][33m,[39m
     [90m 321 |[39m     })[33m;[39m
    [31m[1m>[22m[39m[90m 322 |[39m     [36mawait[39m expect(appA[33m.[39m[36mget[39m([33mDomainEventDispatcher[39m)[33m.[39mdrain(filter))[33m.[39mresolves[33m.[39mtoBe(
     [90m     |[39m           [31m[1m^[22m[39m
     [90m 323 |[39m       [35m0[39m[33m,[39m
     [90m 324 |[39m     )[33m;[39m
     [90m 325 |[39m   })[33m;[39m[0m

      at expect (../node_modules/expect/build/index.js:2116:15)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:322:11)

  ● DomainEventDispatcher (e2e) › drains a backlog of 120 events in batches of at most 50

    TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

    [0m [90m 109 |[39m     [36mconst[39m d [33m=[39m [36mawait[39m db[33m.[39m$queryRaw[33m<[39m[33munknown[39m[][33m>[39m([33mPrisma[39m[33m.[39msql[32m`SELECT "id","status","availableAt", now() AS n, clock_timestamp() AS c, ("availableAt" <= now()) AS due, pg_backend_pid() AS pid FROM ${name} WHERE ${options.filter}`[39m)[33m;[39m
     [90m 110 |[39m     [90m// eslint-disable-next-line[39m
    [31m[1m>[22m[39m[90m 111 |[39m     require([32m'node:fs'[39m)[33m.[39mappendFileSync(process[33m.[39menv[33m.[39m[33mDBG_LOG[39m [36mas[39m string[33m,[39m [36mnew[39m [33mDate[39m()[33m.[39mtoISOString() [33m+[39m [32m' '[39m [33m+[39m table [33m+[39m [32m' empty claim; rows='[39m [33m+[39m [33mJSON[39m[33m.[39mstringify(d) [33m+[39m [32m'\n'[39m)[33m;[39m
     [90m     |[39m                        [31m[1m^[22m[39m
     [90m 112 |[39m   }
     [90m 113 |[39m   [36mreturn[39m __res[33m;[39m
     [90m 114 |[39m }[0m

      at claimBatch (../src/common/outbox/outbox-claims.ts:111:24)
      at DomainEventDispatcher.runOnce (../src/domain-events/domain-event-dispatcher.ts:69:20)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:333:19)

  ● DomainEventDispatcher (e2e) › drainDomainEvents processes only the events of the given root aggregates

    TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

    [0m [90m 109 |[39m     [36mconst[39m d [33m=[39m [36mawait[39m db[33m.[39m$queryRaw[33m<[39m[33munknown[39m[][33m>[39m([33mPrisma[39m[33m.[39msql[32m`SELECT "id","status","availableAt", now() AS n, clock_timestamp() AS c, ("availableAt" <= now()) AS due, pg_backend_pid() AS pid FROM ${name} WHERE ${options.filter}`[39m)[33m;[39m
     [90m 110 |[39m     [90m// eslint-disable-next-line[39m
    [31m[1m>[22m[39m[90m 111 |[39m     require([32m'node:fs'[39m)[33m.[39mappendFileSync(process[33m.[39menv[33m.[39m[33mDBG_LOG[39m [36mas[39m string[33m,[39m [36mnew[39m [33mDate[39m()[33m.[39mtoISOString() [33m+[39m [32m' '[39m [33m+[39m table [33m+[39m [32m' empty claim; rows='[39m [33m+[39m [33mJSON[39m[33m.[39mstringify(d) [33m+[39m [32m'\n'[39m)[33m;[39m
     [90m     |[39m                        [31m[1m^[22m[39m
     [90m 112 |[39m   }
     [90m 113 |[39m   [36mreturn[39m __res[33m;[39m
     [90m 114 |[39m }[0m

      at claimBatch (../src/common/outbox/outbox-claims.ts:111:24)
      at DomainEventDispatcher.runOnce (../src/domain-events/domain-event-dispatcher.ts:69:20)
      at DomainEventDispatcher.drain (../src/domain-events/domain-event-dispatcher.ts:101:23)
      at drainDomainEvents (utils/domain-events.ts:24:3)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:344:5)

  ● DomainEventDispatcher (e2e) › a stale-released event does not repeat a handler that already committed

    TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

    [0m [90m 109 |[39m     [36mconst[39m d [33m=[39m [36mawait[39m db[33m.[39m$queryRaw[33m<[39m[33munknown[39m[][33m>[39m([33mPrisma[39m[33m.[39msql[32m`SELECT "id","status","availableAt", now() AS n, clock_timestamp() AS c, ("availableAt" <= now()) AS due, pg_backend_pid() AS pid FROM ${name} WHERE ${options.filter}`[39m)[33m;[39m
     [90m 110 |[39m     [90m// eslint-disable-next-line[39m
    [31m[1m>[22m[39m[90m 111 |[39m     require([32m'node:fs'[39m)[33m.[39mappendFileSync(process[33m.[39menv[33m.[39m[33mDBG_LOG[39m [36mas[39m string[33m,[39m [36mnew[39m [33mDate[39m()[33m.[39mtoISOString() [33m+[39m [32m' '[39m [33m+[39m table [33m+[39m [32m' empty claim; rows='[39m [33m+[39m [33mJSON[39m[33m.[39mstringify(d) [33m+[39m [32m'\n'[39m)[33m;[39m
     [90m     |[39m                        [31m[1m^[22m[39m
     [90m 112 |[39m   }
     [90m 113 |[39m   [36mreturn[39m __res[33m;[39m
     [90m 114 |[39m }[0m

      at claimBatch (../src/common/outbox/outbox-claims.ts:111:24)
      at DomainEventDispatcher.runOnce (../src/domain-events/domain-event-dispatcher.ts:69:20)
      at DomainEventDispatcher.drain (../src/domain-events/domain-event-dispatcher.ts:101:23)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:391:5)

  ● DomainEventDispatcher (e2e) › schedules a failed event about 30 s ahead by the database clock

    expect(received).resolves.toBe()

    Received promise rejected instead of resolved
    Rejected to value: [TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined]

    [0m [90m 508 |[39m     [36mconst[39m filter [33m=[39m [36mawait[39m filterFor([32m'failing'[39m)[33m;[39m
     [90m 509 |[39m
    [31m[1m>[22m[39m[90m 510 |[39m     [36mawait[39m expect(appA[33m.[39m[36mget[39m([33mDomainEventDispatcher[39m)[33m.[39mdrain(filter))[33m.[39mresolves[33m.[39mtoBe(
     [90m     |[39m           [31m[1m^[22m[39m
     [90m 511 |[39m       [35m1[39m[33m,[39m
     [90m 512 |[39m     )[33m;[39m
     [90m 513 |[39m[0m

      at expect (../node_modules/expect/build/index.js:2116:15)
      at Object.<anonymous> (domain-event-dispatcher.e2e-spec.ts:510:11)

Test Suites: 2 failed, 2 total
Tests:       7 failed, 2 passed, 9 total
Snapshots:   0 total
Time:        3.973 s, estimated 7 s
Ran all test suites matching test/webhooks.e2e-spec.ts|test/domain-event-dispatcher.e2e-spec.ts.
Jest did not exit one second after the test run has completed.

'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
