Closed gulaandrij closed 4 years ago
Fixed in 4.0.3. Thanks for reporting!
I'm still seeing this even on 4.03. I've forked the above repo with 4.0.3 and still see the issue:
https://github.com/danhooper/nest-monorepo-swagger
npm i
nest build
Starting type checking service...
Using 1 worker with 2048MB memory limit
/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/typescript/lib/typescript.js:95861
throw e;
^
TypeError: Cannot read property 'text' of undefined
at IdentifierObject.TokenOrIdentifierObject.getText (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/typescript/lib/typescript.js:130308:31)
at Object.getDecoratorName (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/utils/ast-utils.js:88:65)
at find.item (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/utils/plugin-utils.js:8:89)
at Array.find (<anonymous>)
at Object.getDecoratorOrUndefinedByNames (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/utils/plugin-utils.js:8:49)
at ControllerClassVisitor.getStatusCodeIdentifier (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:65:50)
at ControllerClassVisitor.createStatusPropertyAssignment (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:60:33)
at ControllerClassVisitor.createDecoratorObjectLiteralExpr (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:35:18)
at ControllerClassVisitor.addDecoratorToNode (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:27:22)
at visitNode (/Users/hoopedc1/git/nest-monorepo-swagger/node_modules/@nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:16:29)
still the same situation
ping @kamilmysliwiec
My mistake. Please update once again @gulaandrij @danhooper. 4.0.4 should be fine
@kamilmysliwiec I have added DTO and receive the same error. Repo updated
4.0.4 seems to fix it for my use case. Thanks!
Actually I spoke to soon. Once I enable the DTO option I started getting the same error as well.
@kamilmysliwiec 4.0.6 still the same
Thanks for the quick feedback! Please, test with 4.0.7 :)
@kamilmysliwiec test repo now working fine. But my main project still failing with this error I'm trying to reproduce it on test repo now
@kamilmysliwiec I found an issue. Looks like it fails when dto is in lib and I use it in my main app. Repo updated
also, could you reopen this while it still failing?
Sure thing. @gulaandrij thanks for your commitment. I've just pushed another fix that should solve your issue.
tnx, it fix first start but got an error in watch mode. Steps to reproduce:
1. nest start --watch
2. add decorator @ApiResponse({status: 200}) in apps/swagger/src/app.controller.ts to trigger rebuild
repo updated
Thanks for the investigation, it takes forever 😄 Please, update to the latest version and let me know if you are still encountering this issue
tnx, errors have gone
@kamilmysliwiec The same bug happens when using yarn workspaces (monorepo). I don't have a public reproduction but the structure is similar to this https://github.com/AMGAVentures/poc-monorepo-starter
yarn workspaces enables us to use a single node_modules
located at the root, but my nest app is at packages/api
.
By copy/pasting node_modules/@nestjs/swagger
folder to the nest app folder packages/api/node_modules
, it works again. Basically the bug seems to happen when node_modules
is not in the same folder than the nest app folder.
the error "cannot read property 'kind' of undefined" is present yet.
I've just open a new Issue about it:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
nest start
fails with new swagger pluginExpected behavior
app started
Minimal reproduction of the problem with instructions
https://github.com/gulaandrij/nest-monorepo-swagger steps:
What is the motivation / use case for changing the behavior?
Environment