Trivial sample does not work (TypeError: Cannot read property '0' of undefined)
See original GitHub issuetrying to do very simple sample code and get error (TypeError: Cannot read property ‘0’ of undefined);
@Controller('test')
export class TestController {
@Get(':id')
getById(@Param('id') id : string) {
return `This action was called with id=#${id}`;
}
@Get('all')
findAll(): string {
return 'This action returns nothing';
}
}
I’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
Does not start if there is usage of @Param or @Query.
Expected behavior
Should start and generate proper documentation
Minimal reproduction of the problem with instructions
Minimal module and the controller specified above.
What is the motivation / use case for changing the behavior?
Basic functionality should work.
Environment
Nest version: 6.10.12
Nest Swagger version: 4.0.9
For Tooling issues:
- Node version: 12.14.0
- Platform: Mac
Others:
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >TypeError, cannot read property 0 of undefined - Stack Overflow
What you are trying to do is access the property that is called 'arr' on the object results. That ...
Read more >cannot read properties of undefined (reading '0') node js
And the error is the following: TypeError: Cannot read properties of undefined (reading '0'). I've tried async and await but it didn't work...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Help: TypeError: Cannot read property '0' of undefined
I have the same problem. I've seen other posts suggesting it's a problem with var (for example see this post: https://discourse.psychopy.org/t ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found the issue. “emitDecoratorMetadata”: true, was missing in tsconfig. If you remove it you will get this error. I think we can close the issue.
@gilzarfati check @nestjs/platform-express version. https://github.com/nestjs/swagger/issues/434