You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using disableIdentityMap on the queries, I would expect that check for the Request context wouldn't trigger, because this flag will fork the entity manager every time
Stack trace
Error: ValidationError: Using global EntityManager instance methods for context specific actions is disallowed. If you need to work with the global instance's identity map, use `allowGlobalContext` configuration option or `fork()` instead.
at Function.cannotUseGlobalContext (/src/node_modules/@mikro-orm/core/errors.js:83:16)
at SqlEntityManager.getContext (/src/node_modules/@mikro-orm/core/EntityManager.js:665:44)
at CustomerRepository.get em [as em] (/src/node_modules/@mikro-orm/knex/SqlEntityRepository.js:30:25)
at CustomerRepository.findAll (/src/node_modules/@mikro-orm/core/entity/EntityRepository.js:63:21)
at AppService.getCustomersFromScript (/src/src/app.service.ts:17:22)
at execute (/src/scripts/test.ts:10:32)
The problem is actually only if you use repository, as the validation is triggered by accessing the EM from a repository (which takes the one from context automatically), not by using the EM API directly.
Describe the bug
When using
disableIdentityMap
on the queries, I would expect that check for the Request context wouldn't trigger, because this flag will fork the entity manager every timeStack trace
To Reproduce
Steps to reproduce the behavior:
docker-compose up
docker-compose exec api node_modules/.bin/ts-node scripts/test.ts
Expected behavior
Expected to be able to run the query because I passed
disableIdentityMap: true
to it. Code here.Versions
The text was updated successfully, but these errors were encountered: