Anubhav@12
Anubhav@12
PPrisma
Created by Virgile on 10/7/2024 in #help-and-questions
Still unable to get Optimize working in my NestJS app.
Its a private repo but i will try to make a reproducible example of this repo in a public repo then i will share the link
12 replies
PPrisma
Created by Virgile on 10/7/2024 in #help-and-questions
Still unable to get Optimize working in my NestJS app.
@Nurul (Prisma) I have also facing the same issue on my backend, I am using Nest.js, Prisma and swagger. This is my databaseService code
@Injectable()
export class DatabaseService extends PrismaClient implements OnModuleInit {
constructor( private configService: ConfigService ) {
super()
}

async onModuleInit() {
const prisma = new PrismaClient().$extends(
withOptimize({ apiKey: this.configService.getOrThrow('OPTIMIZE_API_KEY') })
)

Object.assign(this, prisma);

await this.$connect();
console.log('Database initialized!');
}
}
@Injectable()
export class DatabaseService extends PrismaClient implements OnModuleInit {
constructor( private configService: ConfigService ) {
super()
}

async onModuleInit() {
const prisma = new PrismaClient().$extends(
withOptimize({ apiKey: this.configService.getOrThrow('OPTIMIZE_API_KEY') })
)

Object.assign(this, prisma);

await this.$connect();
console.log('Database initialized!');
}
}
I'm getting the log that see your optimize dashboard but not getting anything in the prisma optimize dashboard when running the api's in the swagger.
12 replies
PPrisma
Created by Txt on 9/25/2024 in #help-and-questions
NestJs + Prisma Optimize
@Nurul (Prisma) I have also facing the same issue on my backend, I am using Nest.js, Prisma and swagger. This is my databaseService code
@Injectable()
export class DatabaseService extends PrismaClient implements OnModuleInit {
constructor( private configService: ConfigService ) {
super()
}

async onModuleInit() {
const prisma = new PrismaClient().$extends(
withOptimize({ apiKey: this.configService.getOrThrow('OPTIMIZE_API_KEY') })
)

Object.assign(this, prisma);

await this.$connect();
console.log('Database initialized!');
}
}
@Injectable()
export class DatabaseService extends PrismaClient implements OnModuleInit {
constructor( private configService: ConfigService ) {
super()
}

async onModuleInit() {
const prisma = new PrismaClient().$extends(
withOptimize({ apiKey: this.configService.getOrThrow('OPTIMIZE_API_KEY') })
)

Object.assign(this, prisma);

await this.$connect();
console.log('Database initialized!');
}
}
I'm getting the log that see your optimize dashboard but not getting anything in the prisma optimize dashboard when running the api's in the swagger.
17 replies