-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Error: 'Invalid value used in weak set' in Nestia Swagger Generation After Introducing PrismaModule #631
Comments
At first, change For reference, the reason of the bug is occured by below code, and such I'll fix this bug ASAP. Thanks for special reporting. Change
|
export namespace ReflectAnalyzer { | |
export async function analyze( | |
unique: WeakSet<any>, | |
file: string, | |
): Promise<IController[]> { | |
const module: IModule = await (async () => { | |
try { | |
return await import(file); | |
} catch (exp) { | |
console.log( | |
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", | |
); | |
console.log(`Error on "${file}" file. Check your code.`); | |
console.log(exp); | |
console.log( | |
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", | |
); | |
process.exit(-1); | |
} | |
})(); | |
const ret: IController[] = []; | |
for (const tuple of Object.entries(module)) { | |
if (unique.has(tuple[1])) continue; | |
else unique.add(tuple[1]); |
Your prisma.module.ts
file
export const PRISMA_INJECTION_TOKEN = "PrismaService";
Fix #631 - when non-class value being exported
Firstly thanks for the excellent work! It works very well and we decided to put nestia into our code base.
Summary
The bug manifests during the Nestia Swagger generation process. Initially, it ran smoothly until I added a straightforward PrismaModule following the official NestJS documentation. Strangely, even without importing it explicitly, the Swagger generation now throws an error: "Invalid value used in weak set."
npx nestia swagger
should generate successfullynpx nestia swagger
shows error "Invalid value used in weak set."I've made a github project to demonstrate this bug.
https://github.com/Val0429/nestia-swagger-weakmap-issue
git checkout 75d577c: It's the code which works
git checkout main: Not working
The text was updated successfully, but these errors were encountered: