Skip to content

TypeError when trying to inject request scoped service #23

@Blacksmoke16

Description

@Blacksmoke16

I ran into an issue similar to #9, but when the service is Request Scoped.

For example, using the existing can inject other providers into the factory test case within Loader.test.ts, but making the service definition like:

@Injectable({ scope: Scope.REQUEST })
class TestService {
  test() {
    return { path: "/path" };
  }
}

Yields:

[Nest] 74692  - 09/25/2025, 8:58:45 PM   ERROR [ExceptionsHandler] TypeError: Receiver must be an instance of class DataloaderFactory
    at DataLoader._batchLoadFn (/Users/george/Downloads/nestjs-dataloader/src/Dataloader.factory.ts:19:18)
    at dispatchBatch (/Users/george/Downloads/nestjs-dataloader/node_modules/dataloader/index.js:288:27)
    at /Users/george/Downloads/nestjs-dataloader/node_modules/dataloader/index.js:268:5
    at processTicksAndRejections (node:internal/process/task_queues:85:11)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions