strongloop / loopback4-example-microservices

Deprecated - please use https://github.com/strongloop/loopback4-example-shopping/tree/master/kubernetes
http://loopback.io
Other
88 stars 28 forks source link

Example "account-without-juggler" does not work (anymore?) with NodeJS 10.10.0 #98

Open koalabi opened 5 years ago

koalabi commented 5 years ago

Tried above mentioned example (coming from the official Loopback 4 documentation (https://loopback.io/doc/en/lb4/Repositories.html). Example crashes at runtime with message "Cannot start the app. Error: The key servers.RestServer was not bound to any value." Googling and searching through the Loopback 4 documentation (such as https://loopback.io/doc/en/lb4/Server.html and https://loopback.io/doc/en/lb4/Application.html#servers) didn't help.

Versions: Node: 10.10.0 npm: 6.4.1 TypeScript: tsc 2.8.3

package.json: { "name": "account", "version": "1.0.0", "description": "The Account microservice.", "main": "index.ts", "engines": { "node": ">=8" }, "dependencies": { "@loopback/core": "^0.2.1", "@loopback/repository": "^0.2.1", "@loopback/rest": "^0.3.0", "mysql": "^2.13.0", "mysql-promise": "^4.1.0" }, "devDependencies": { "@loopback/testlab": "^0.4.0", "@types/mocha": "^2.2.41", "@types/node": "^8.0.47", "debug": "^2.6.8", "lodash": "^4.17.4", "mocha": "^4.0.1", "ts-node": "^3.0.4", "tslint": "^5.4.3", "typescript": "^2.4.1" }, "scripts": { "start": "ts-node index.ts", "test": "mocha --opts test/mocha.opts 'test/unit/*.ts'" }, "keywords": [ "loopback-next", "example", "account", "microservice" ], "repository": { "type": "git", "url": "git+https://github.com/strongloop/loopback4-example-microservices.git" }, "bugs": { "url": "https://github.com/strongloop/loopback4-example-microservices/issues" }, "homepage": "https://github.com/strongloop/loopback4-example-microservices#readme", "author": "IBM", "license": "MIT" }

Description/Steps to reproduce

git clone https://github.com/strongloop/loopback4-example-microservices.git cd services/account-without-juggler npm i (fix minor bug in index.ts, l. 33: const port: Number = await rest.get(RestBindings.PORT) as Number; npm start

application attempts to start but crashes with stacktrace:

alain@aegnor:/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler$ npm start

account@1.0.0 start /media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler ts-node index.ts

Cannot start the app. Error: The key servers.RestServer was not bound to any value. at AccountMicroservice.getBinding (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/node_modules/@loopback/context/src/context.ts:379:11) at AccountMicroservice.getValueOrPromise (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/node_modules/@loopback/context/src/context.ts:420:26) at AccountMicroservice.get (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/node_modules/@loopback/context/src/context.ts:263:23) at AccountMicroservice.getServer (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/node_modules/@loopback/core/src/application.ts:125:23) at AccountMicroservice.info (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/index.ts:32:29) at main (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/index.ts:46:46) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:745:11) at Object. (/media/elrond_2tb/devel/strongloop/thirdparty/loopback4-example-microservices/services/account-without-juggler/node_modules/ts-node/src/_bin.ts:182:12) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:279:19) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! account@1.0.0 start: ts-node index.ts npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the account@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/alain/.npm/_logs/2018-10-06T20_29_14_826Z-debug.log

I cannot find how to bind the requested key to some value :-(

koalabi commented 5 years ago

Trying with tsc 3.1.1 didn't change anything.