-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrismaClient proxy create an infinite loop #21615
Comments
Are you effectively reporting the same problem as #18292? |
I guess so, not sure if this is a problem with nestjs compatibility, I tried to locate the problem, it seems that the _engine attribute is always undefined, Node addons seem to be unable to load, when I switch to singleton pattern everything is fine. import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
prisma.$connect().then(() => {
console.log('prisma connected')
})
export default prisma |
Hey @JinYuSha0, could you please provide us with a reproduction? Without it we will not be able to make progress and will end up closing the issue via our internal process. Thanks 🙏 |
Hey @JinYuSha0 , Did you get a chance to have a look at @millsp's previous comment? It'd be helpful for us to move your issue forward. Without further information, we'll have to close this issue. Thank you 🙏 |
@millsp @SevInf This problem is still there, I can provide code snippets // PrismaProvider.ts
import { Provider } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PrismaClient } from '@prisma/client';
export const PRISMA = Symbol('PrismaSymbol');
export const PrismaProvider: Provider = {
provide: PRISMA,
useFactory: (configService: ConfigService) => {
return new PrismaClient();
},
inject: [ConfigService],
}; // CommonModule.ts
import { PrismaProvider } from '@/common/prisma.provider';
@Global()
@Module({
imports: [CacheModule],
providers: [
PrismaProvider,
],
exports: [
PrismaProvider,
],
})
export class CommonModule {} // SomeService.ts
@Injectable()
export class SomeService {
constructor(
@Inject(PRISMA) private readonly prisma: typeof Prisma,
) {}
public async someMethod() {
this.prisma; // just access
}
} |
#23228 could have fixed this and will be included in the next release, but of course a confirmation of it now working as intended would be nice. Could you please try to temporarily install |
I did |
@JinYuSha0 could you confirm that the issue is fixed in 5.11 as well? |
Hey @JinYuSha0, did you manage to try |
I am going to close the issue for now. If it still happens for you for prisma 5.11 or creater, feel free to open a new one. |
Bug description
I use Prisma with nestjs, when my service access the PrismaClient instance enter an infinite loop. causing the service to hang.
I found through the debugger that the infinite loop occurred in @prisma/client/runtime/libary
2023-10-25.20.28.15.mov
I'm sure I didn't use it improperly, Don't know what causes this problem
How to reproduce
Expected behavior
No response
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: