question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trivial sample does not work (TypeError: Cannot read property '0' of undefined)

See original GitHub issue

trying 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:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vmikhailovcommented, Dec 27, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found