Crud: Error: Cannot read property 'getMany' of undefined

Created on 28 Jul 2019  路  4Comments  路  Source: nestjsx/crud

Hi,

I am getting this error:

[ExceptionsHandler] Cannot read property 'getMany' of undefined +14494ms
TypeError: Cannot read property 'getMany' of undefined
at StockController.getManyBase (C:\git_wa\privat\myStocks\crud-test-reponode_modules\@nestjsx\crud\lib\crud\crud-routes.factory.js:115:33)
at C:\git_wa\privat\myStocks\crud-test-reponode_modules\@nestjs\core\router\router-execution-context.js:36:29
at process._tickCallback (internal/process/next_tick.js:68:7)

I got a pretty basic setup. Just one Feature Module which should use nestjsx/crud to setup all the routes.

Here is a example repo which reproduces the error:
https://github.com/MeMeMax/crud-test-repo

Does anyone have a idea why this happens?

Most helpful comment

https://github.com/MeMeMax/crud-test-repo/blob/b83064c68d7625618b94518ecc05abaa2e12c232/src/stock/controllers/stock.controller.ts#L14

Change stockService to service and it will work. Crud services must be provided in controllers as a property name called service

All 4 comments

https://github.com/MeMeMax/crud-test-repo/blob/b83064c68d7625618b94518ecc05abaa2e12c232/src/stock/controllers/stock.controller.ts#L14

Change stockService to service and it will work. Crud services must be provided in controllers as a property name called service

@zMotivat0r Thanks for your help. This should be documented as a Warning or a hint in the docs. Someone likes to have service names which reflect the service and might step into this pitfall.

@MeMeMax yeah, you're probably right. I'll be glad to see a PR from you, if you want :)

@zMotivat0r, are there any way to custom this name?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjancsar picture cjancsar  路  4Comments

leo-jnesis picture leo-jnesis  路  5Comments

Darkein picture Darkein  路  3Comments

rainercedric23 picture rainercedric23  路  3Comments

si-hyeon-ee picture si-hyeon-ee  路  5Comments