Reputation: 71
My application was working fine, and it stopped after trying to get the documentation with swagger, i think it may be a dependency issue, but can't find it anywhere.
I keep getting the error
10:10:22 PM - Starting compilation in watch mode...
Error Cannot read property 'getSymbol' of undefined
I don't know where getSymbol is used, and the error doesn't seem to help much. Hope someone can help me fix this issue. The complete application code can be found at:
https://github.com/JSLearningCode/enderecosAlunosAPI
Any help is welcome.
EDIT: Running in dev mode I got this output:
/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:95877 throw e; ^
TypeError: Cannot read property 'getSymbol' of undefined at Object.isArray (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/utils/ast-utils.js:6:25) at getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/utils/plugin-utils.js:12:21) at Object.getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/utils/plugin-utils.js:31:29) at ControllerClassVisitor.createTypePropertyAssignment (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:51:44) at ControllerClassVisitor.createDecoratorObjectLiteralExpr (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:38:18) at ControllerClassVisitor.addDecoratorToNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:29:22) at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:16:29) at visitNodes (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:70998:48) at Object.visitEachChild (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:71266:355) at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:18:23) error Command failed with exit code 1.
Upvotes: 5
Views: 22190
Reputation: 124
This solution is not working right now. Because nestjs swagger plugin is updated.
Old answer:
Please check your method result type of controller
Change this:
@Contoller()
export class MyController {
// ...
async myMethod() {
return {}
}
}
to:
@Contoller()
export class MyController {
// ...
async myMethod():Promise<any> {
return {}
}
}
Upvotes: 0
Reputation: 71
There was an issue related to the routing in the application. I had a parser inside the controller that was used for directing correct routes between a route "aluno" with first Param. Once I had taken the route with no params and put it first at the controller, there was no need anymore for the parser, and the issue was gone. Hope this answer helps more people if they get the same problem.
Upvotes: 2