moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
291 stars 119 forks source link

Problems encountered when integrating moleculerjs and moleculer-java:Cannot read property 'rest' of undefined #302

Closed baozhoutao closed 2 years ago

baozhoutao commented 2 years ago

This is a great project 👏👏👏

In the moleculer-spring-boot-demo project, connect the transporter of the moleculerjs project. Cause the moleculerjs service to hang

TypeError: Cannot read property 'rest' of undefined
    at F:\GitHub\steedos-platform\node_modules\moleculer-web\src\index.js:1384:61
    at Array.forEach (<anonymous>)
    at Service.regenerateAutoAliases (F:\GitHub\steedos-platform\node_modules\moleculer-web\src\index.js:1382:13)
    at F:\GitHub\steedos-platform\node_modules\moleculer-web\src\index.js:1474:64
    at Array.forEach (<anonymous>)
    at Service.<anonymous> (F:\GitHub\steedos-platform\node_modules\moleculer-web\src\index.js:1474:16)
    at invokeFunc (F:\GitHub\steedos-platform\node_modules\lodash\lodash.js:10359:23)
    at trailingEdge (F:\GitHub\steedos-platform\node_modules\lodash\lodash.js:10408:18)
    at Timeout.timerExpired [as _onTimeout] (F:\GitHub\steedos-platform\node_modules\lodash\lodash.js:10396:18)

image

baozhoutao commented 2 years ago

service.settings is undefined

service {
  name: 'api-gw',
  version: undefined,
  fullName: 'api-gw',
  settings: undefined,
  metadata: {},
  local: false,
  available: true,
  nodes: [ 'zhoutaodemac-mini.local-37885' ],
  actions: {}
}
F:\GitHub\steedos-platform\node_modules\moleculer-web\src\index.js:1385
                                const basePath = addSlashes(_.isString(service.settings.rest) ? service.settings.rest : serviceName.replace(/\./g, "/")); 
icebob commented 2 years ago

Please upgrade, this issue is fixed in the latest version:

https://github.com/moleculerjs/moleculer-web/blob/b858f1ee67aa4bd3434ba981d43d2fdf249f4402/src/index.js#L1476