i am running a nest project in debug mode inside visual studio code
on run it throws this exception
Exception has occurred: TypeError: Cannot read properties of undefined (reading 'getConfig')at Object.getConfig
at the same time, the solution along with prisma runs normally without debug mode
here is my launch.json file
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest Framework",
"args": ["${workspaceFolder}/src/main.ts"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector"
}
]
}
this is the root AppModule
/*imports...*/
@Module({
imports: [ControllersModule, ConfigModule.forRoot({
isGlobal: true,
envFilePath: `.env`
// ignoreEnvFile: process.env.ENV !== `DEV`,
}), AuthModule, UsersModule, ScheduleModule.forRoot()
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule { }
prisma.service.ts code :
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'
import { PrismaClient } from '@prisma/client'
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
async onModuleInit() {
await this.$connect()
}
async onModuleDestroy() {
await this.$disconnect()
}
}
