SAP-samples / hana-opensap-cloud-2020

Exercise materials for openSAP courses targeted to application developers, SAP HANA developers, Cloud Application Programming Model developers, and SAP Business Technology Platform developers.
https://open.sap.com/courses/hana7
Apache License 2.0
77 stars 46 forks source link

VError: No service matches uaa / How to cds run / build / watch / serve / cf push -f srv/gen #33

Closed matt-wombat closed 3 years ago

matt-wombat commented 3 years ago

Hello,

thank you for your very nice repository. I did follow the exercises of the openSAP hana7 course and did actually build the github repository hana-xsa-opensap-hana7 on my HANA express. As I found it most useful I am now trying to clone and build the hana-opensap-cloud-2020 repo into my SAP BTP trial account with a HANA cloud trial database.

Up until now I have done everything stated in the install-all-prerequsites.md file, meaning I have successfully installed SFLIGHT, executed all SQL commands and created the CUPS_FLIGHT user with roles, and also executed all CF commands for creating the HDI containers, UPS for SFLIGHT schema, HTTP UPS and UAA.

I also reproduced some instructions from https://blogs.sap.com/2021/01/21/building-hana-opensap-cloud-2020-part-2-project-setup-and-first-db-build/ which seemed to be helpful.

My database is now successfully deployed to the HANA cloud and the user provided services seem to work. I can deploy the DB module using the small rocket icon in the BAS and also jump from the BAS into the respective HDI containers. From the database perspective everythin seems to be in order.

As I read in your reply https://github.com/SAP-samples/hana-opensap-cloud-2020/issues/18#issuecomment-655142079 where you are stating that the most easy way to test a module would be to do

cds run or cds watch

I have also tried

npm start

Unfortunately nothing works as I always get an error which can be most easily reproduced by executing npm start

There seems to be something regarding the UAA.

Here is the error:

user: hana-opensap-cloud-2020 $ npm start npm WARN lifecycle The node binary used for scripts is /extbin/bin/node but npm is using /opt/nodejs/node-v14.16.0-linux-x64/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

hana-opensap-cloud-2020@1.202101.1 start /home/user/projects/hana-opensap-cloud-2020 cds run

2 /home/user/projects/hana-opensap-cloud-2020/srv/ CDS Custom Boostrap from /srv/server.js

2.0#2021 06 10 16:21:45:916#+00:00#WARNING#/LoggingLibrary################PLAIN##Dynamic log level switching not available

[ERROR] VError: No service matches uaa at Object.getServices (/home/user/projects/hana-opensap-cloud-2020/node_modules/@sap/xsenv/lib/xsservices.js:50:15) at module.exports (/home/user/projects/hana-opensap-cloud-2020/srv/server/expressSecurity.js:31:57) at module.exports (/home/user/projects/hana-opensap-cloud-2020/srv/server/express.js:14:33) at module.exports (/home/user/projects/hana-opensap-cloud-2020/srv/server.js:45:35) at serve (/home/user/projects/hana-opensap-cloud-2020/node_modules/@sap/cds/bin/serve.js:174:24) at Object.cds_run (/home/user/projects/hana-opensap-cloud-2020/node_modules/@sap/cds/bin/run.js:23:12) at Object.exec (/home/user/projects/hana-opensap-cloud-2020/node_modules/@sap/cds/bin/cds.js:19:17) at Object. (/home/user/projects/hana-opensap-cloud-2020/node_modules/@sap/cds/bin/cds.js:97:26) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! hana-opensap-cloud-2020@1.202101.1 start: cds run npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the hana-opensap-cloud-2020@1.202101.1 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/user/.npm/_logs/2021-06-10T16_21_46_115Z-debug.log

Here is the debug.log:

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli '/opt/nodejs/node-v14.16.0-linux-x64/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'start' 1 verbose cli ] 2 info using npm@6.14.11 3 info using node@v14.16.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle hana-opensap-cloud-2020@1.202101.1~prestart: hana-opensap-cloud-2020@1.202101.1 6 info lifecycle hana-opensap-cloud-2020@1.202101.1~start: hana-opensap-cloud-2020@1.202101.1 7 warn lifecycle The node binary used for scripts is /extbin/bin/node but npm is using /opt/nodejs/node-v14.16.0-linux-x64/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with. 8 verbose lifecycle hana-opensap-cloud-2020@1.202101.1~start: unsafe-perm in lifecycle true 9 verbose lifecycle hana-opensap-cloud-2020@1.202101.1~start: PATH: /opt/nodejs/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/user/projects/hana-opensap-cloud-2020/node_modules/.bin:/home/user/.node_modules_global/bin:/extbin/bin:/extbin/npm/docker/bin:/extbin/npm/globals/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/curl/bin 10 verbose lifecycle hana-opensap-cloud-2020@1.202101.1~start: CWD: /home/user/projects/hana-opensap-cloud-2020 11 silly lifecycle hana-opensap-cloud-2020@1.202101.1~start: Args: [ '-c', 'cds run' ] 12 silly lifecycle hana-opensap-cloud-2020@1.202101.1~start: Returned: code: 1 signal: null 13 info lifecycle hana-opensap-cloud-2020@1.202101.1~start: Failed to exec start script 14 verbose stack Error: hana-opensap-cloud-2020@1.202101.1 start: cds run 14 verbose stack Exit status 1 14 verbose stack at EventEmitter. (/opt/nodejs/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 14 verbose stack at EventEmitter.emit (events.js:315:20) 14 verbose stack at ChildProcess. (/opt/nodejs/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 14 verbose stack at ChildProcess.emit (events.js:315:20) 14 verbose stack at maybeClose (internal/child_process.js:1048:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) 15 verbose pkgid hana-opensap-cloud-2020@1.202101.1 16 verbose cwd /home/user/projects/hana-opensap-cloud-2020 17 verbose Linux 5.4.0-5-cloud-amd64 18 verbose argv "/opt/nodejs/node-v14.16.0-linux-x64/bin/node" "/usr/local/bin/npm" "start" 19 verbose node v14.16.0 20 verbose npm v6.14.11 21 error code ELIFECYCLE 22 error errno 1 23 error hana-opensap-cloud-2020@1.202101.1 start: cds run 23 error Exit status 1 24 error Failed at the hana-opensap-cloud-2020@1.202101.1 start script. 24 error This is probably not a problem with npm. There is likely additional logging output above. 25 verbose exit [ 1, true ]

These are my service instances (I don't think the error is due to the red update failed label as the error persisted before the last update failed):

image

I have already experimented a lot with the name of the uaa-service in the mta.yaml in order to have it match the instance name in my BTP trial account. But I could not figure it out. Would you be so kind to give me a hint where to look at?

jung-thomas commented 3 years ago

Well cloning the project and running it straight away even with the prerequisites would still be missing the default-env.json; which is exactly what this error is saying. When running cds run or npm start from the Business Application Studio it doesn't deploy the services to CF like the old Web IDE used to. You need this default-env.json file to locally emulate the environment of Cloud Foundry for your service. Have a look at this video playlist to show how this newer version of the project was built using HANA Cloud and Business Application Studio: https://www.youtube.com/playlist?list=PL6RpkC85SLQAHZ_V3cZsTok0T6BvI4HT1

The second video in the series will cover the usage of the default-env.json in general, although the UAA section isn't added until later in the series. https://www.youtube.com/watch?v=t3nIXxibmso&list=PL6RpkC85SLQAHZ_V3cZsTok0T6BvI4HT1&index=2

matt-wombat commented 3 years ago

Thank you very much for your fast answer! I will look into the default-env.json

To be honest I already found the playlist, I even scrubbed in some of the videos back and forth. But I cannot view the second video on in. When I click on your link pointing to index=2 my browser immediately skips video number two and goes to index=3 in the list. Video number two seems to be private. I can't see it even if I'm logged in with my YT Premium account. Is there something else to know to view this vide?

Here's what I see: image

jung-thomas commented 3 years ago

I actually meant the video with the name part 2 - which is the fourth video in the playlist. I see what’s going on with #2 in the playlist. It’s not a critical item as that was the livestream where we took suggestions for what to cover in this learning series. Interesting but not critical. I’ll correct that item in the playlist shortly. Thanks for pointing it out.