loopback4-example-microservices
loopback4-example-microservices copied to clipboard
Example "account-without-juggler" does not work (anymore?) with NodeJS 10.10.0
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
[email protected] 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.ts-node index.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 :-(
Trying with tsc 3.1.1 didn't change anything.