I'm encountering an issue where I can inject the PrismaService from another module into the ScreenshotController, but I am unable to inject it into the ScreenshotService. What could be causing this problem, and how can I resolve it?
prisma.service.ts
@Injectable()
export class PrismaService extends PrismaClient {}
prisma.module.ts
@Global()
@Module({
providers: [PrismaService],
exports: [PrismaService],
})
export class PrismaModule {
}
app.module.ts
@Module({
imports: [
PrismaModule,
AuthModule,
ScreenshotModule,
],
})
export class AppModule {}
screenshot.controller.ts
@Controller('screenshots')
@UseGuards(AuthGuard('auth0'))
export class ScreenshotController {
constructor(
private readonly screenshotService: ScreenshotService,
private readonly prismaClient: PrismaService, // this works
) {}
screenshot.service.ts
@Injectable()
export class ScreenshotService {
constructor(private readonly prismaService: PrismaService) {} // this fails
screenshot.module.ts
@Module({
imports: [
PrismaModule,
],
controllers: [ScreenshotController],
providers: [ScreenshotService],
})
export class ScreenshotModule {}