Closed jrramsaransing closed 1 month ago
Confirmed I have this issue as well
@chgeo - seems that exactly that happened what I explained what we discussed. You fixed the trick and now the build plugin doesn't work anymore!
FYI: I told the CAP colleagues about that trick to ask for a proper solution. We need to align here with an official support to hook in as the last plugin to fix the build. Without the support of the CAP colleagues I can't help here...
@petermuessig That was certainly not done to block you :)
@LotharBender can you check if we get this scenario working short-term? See the item in cap/cds-tools#1323
@petermuessig - you can fix the issue by simply returning the priority value -1
- the return this._priority || 1;
hack is no longer required. This ensures that your plugin gets executed after the internal plugins which have a priority value range from 0 - 512
.
@LotharBender thx for letting me know. As the cds-plugin-ui5
works with older versions of CDS as well, I need to keep this running compatibility wise. Means with @sap/cds-dk@8
I need to use the new priority handling, right?
Change is in prep - I now made it even possible to continue to work with older releases and newer releases of the cds-dk.
New version is available - please update
@petermuessig I'm still getting the error even after updating:
@sammok83: what version of the @sap/cds-dk do you have installed? Somehow the version detection of the @sap/cds-dk doesn't work for you. Can you show me the result of cds --version
after running it in your project directory?
And please show me this part of the log:
I release a new patch #1045 which now states the proper versions also for the cds-plugin-ui5
to get more insights for such scenarios. I assume that there is a version conflict somehwere - I also saw that in some cases, the cds-plugin loads 2 versions of cds and this can also cause such issues because internally in @sap/cds sometimes they load it with require
and sometimes with require(require.resolve(..., paths))
which is slightly different - but I didn't trace this down so much. Would be also interesting if you are in a mono repo or so?
@petermuessig The project is in BAS
@petermuessig I am having similar problems with cds watch
https://github.com/devinea/btp-lcnc-capex branch cds8_watch_broken
In BAS the plugin cds-plugin-ui5
is not loaded when running npm run watch-project1
. It is loaded fine using npm run start
.
user: btp-lcnc-capex $ npm run watch-project1
> capex@1.0.0 watch-project1
> cds watch --open project1/index.html?sap-ui-xx-viewCache=false --livereload false
cds serve all --with-mocks --in-memory?
___________________________
[cds] - loaded model from 5 file(s):
app/services.cds
app/project1/annotations.cds
srv/service.cds
db/schema.cds
node_modules/@sap/cds/common.cds
[cds] - connect using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to db > sqlite { url: ':memory:' }
> init from db/data/sap.ui.lcnc-CapexType.csv
> init from db/data/sap.ui.lcnc-Capex.csv
> init from db/data/sap.ui.lcnc-BusinessUnits.csv
> init from db/data/sap.common-Currencies_texts.csv
> init from db/data/sap.common-Currencies.csv
> init from db/data/sap.common-Countries.csv
/> successfully deployed to in-memory database.
[cds] - using auth strategy { kind: 'dummy', impl: 'node_modules/@sap/cds/lib/auth/dummy-auth' }
[cds] - serving MainOnlineService { path: '/serviceonline' }
-----------------------------------------------------------------------
WARNING: Package '@sap/cds' was loaded from different installations: [
'/home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js',
'/managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js'
] Rather ensure a single install only to avoid hard-to-resolve errors.
-----------------------------------------------------------------------
[cds] - server listening on { url: 'http://localhost:4004' }
[cds] - launched at 7/22/2024, 10:57:51 AM, version: 7.9.4, in: 493.67ms
[cds] - [ terminate with ^C ]
Error opening 'open-browser http://localhost:4004/project1/index.html?sap-ui-xx-viewCache=false' : Command failed: open-browser http://localhost:4004/project1/index.html?sap-ui-xx-viewCache=false
Error: connect ENOENT /extbin/basctl-7e34db04-5bc9-4283-b3b8-a016315e5daf.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)
[odata] - HEAD /serviceonline/
[odata] - GET /serviceonline/$metadata?sap-language=EN
user: btp-lcnc-capex $ cds -v
@cap-js/asyncapi: 1.0.2
@cap-js/openapi: 1.0.4
@sap/cds: 7.9.4
@sap/cds-compiler: 4.9.6
@sap/cds-dk: 8.0.3
@sap/cds-dk (global): 8.0.3
@sap/cds-fiori: 1.2.7
@sap/cds-foss: 5.0.1
@sap/cds-mtxs: 2.0.3
@sap/eslint-plugin-cds: 3.0.4
Node.js: v20.12.0
capex: 1.0.0
home: /home/user/projects/btp-lcnc-capex/node_modules/@sap/cds
Switching the project to cds 8 does not help.
This error seems relevant as locally on macOS the project loads the ui5 plugin for npm run watch-project1
ok.
WARNING: Package '@sap/cds' was loaded from different installations: [
'/home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js',
'/managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js'
] Rather ensure a single install only to avoid hard-to-resolve errors.
Also in BAS node /managed-content/globals/pnpm/5/node_modules/@sap/cds-dk/bin/cds.js watch --open project1/index.html?sap-ui-xx-viewCache=false --livereload false
loads the plugin fine and also '@sap/cds' was loaded from different installations
is not shown.
But npm run watch-project1
fails to load the plugin.
@sammok83 @devinea - I released a new patch of the plugin with some advanced logging for duplicate @sap/cds versions - can you please update and verify and send me the part with the warnings of the duplicate @sap/cds entries please? You should find that in the log. THX
@petermuessig Here you go:
@sammok83 thx - strange - no warning but what I can see it are two different @sap/cds-dk versions - I try to reproduce this locally - let's see where this issue comes from - really strange...
Hmmm, still wondering about the following check not working in your case - a bit strange :-( :
if (!satisfies(cdsdkVersion, ">=8")) {
@petermuessig Here you go
user: btp-lcnc-capex $ npm run watch-project1
> capex@1.0.0 watch-project1
> cds watch --open project1/index.html?sap-ui-xx-viewCache=false --livereload false
cds serve all --with-mocks --in-memory?
___________________________
[cds-plugin-ui5] [info] Running cds-plugin-ui5@0.9.5 (@sap/cds-dk@8.0.3, @sap/cds@8.0.4)
[cds-plugin-ui5] [warn] !! Multiple versions of @sap/cds loaded !!
[cds-plugin-ui5] [warn] => /home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js
[cds-plugin-ui5] [warn] => /managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js
[cds] - loaded model from 5 file(s):
app/services.cds
app/project1/annotations.cds
srv/service.cds
db/schema.cds
node_modules/@sap/cds/common.cds
[cds] - connect using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to db > sqlite { url: ':memory:' }
> init from db/data/sap.ui.lcnc-CapexType.csv
> init from db/data/sap.ui.lcnc-Capex.csv
> init from db/data/sap.ui.lcnc-BusinessUnits.csv
> init from db/data/sap.common-Currencies_texts.csv
> init from db/data/sap.common-Currencies.csv
> init from db/data/sap.common-Countries.csv
/> successfully deployed to in-memory database.
[cds] - using auth strategy { kind: 'dummy', impl: 'node_modules/@sap/cds/lib/auth/dummy-auth' }
[cds] - serving MainOnlineService { path: '/serviceonline' }
-----------------------------------------------------------------------
WARNING: Package '@sap/cds' was loaded from different installations: [
'/home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js',
'/managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js'
] Rather ensure a single install only to avoid hard-to-resolve errors.
-----------------------------------------------------------------------
[cds] - server listening on { url: 'http://localhost:4004' }
[cds] - launched at 7/22/2024, 12:25:05 PM, version: 7.9.4, in: 510.318ms
[cds] - [ terminate with ^C ]
Error opening 'open-browser http://localhost:4004/project1/index.html?sap-ui-xx-viewCache=false' : Command failed: open-browser http://localhost:4004/project1/index.html?sap-ui-xx-viewCache=false
Error: connect ENOENT /extbin/basctl-7ee063e7-5516-46f5-b010-d2e99440bd99.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)
strange thing is the version at /home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/package.json
is 7.9.4 and not 8.0.4
as reported in the log.
AAAHHH, it is different whether you run it with
cds build
==> fails
or
npx cds build
==> works
GRML, let's see where this comes from...
This is a bit weird - if the global binary is used it uses the local installed cds version and if the npx command uses the local cds binary it finds the external one.
Can confirm this is still broken even with cds-dk 8.0.3, but only in BAS.
This is because BAS uses PNPM to install cds-dk, which sets NODE_PATH
in the binstubs:
in /managed-content/globals/pnpm/bin/cds
:
...
if [ -z "$NODE_PATH" ]; then
export NODE_PATH="/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/cds-dk/bin/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/cds-dk/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules:/managed-content/globals/pnpm/5/.pnpm/node_modules"
else
export NODE_PATH="/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/cds-dk/bin/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/cds-dk/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules/@sap/node_modules:/managed-content/globals/pnpm/5/.pnpm/@sap+cds-dk@8.0.3/node_modules:/managed-content/globals/pnpm/5/.pnpm/node_modules:$NODE_PATH"
fi
...
exec node "$basedir/../5/node_modules/@sap/cds-dk/bin/cds.js" "$@"
NODE_PATH
in turn adds the global @sap/cds
installation to the resolution path which finally leads to the warning and the server inconsistency.
npx cds watch
(if @sap-cds-dk
is installed as dev dependency)npx -y -p @sap/cds-dk cds watch
npx cds serve
Basically anything that does not execute /managed-content/globals/pnpm/bin/cds
Talk to the BAS colleagues to remove NODE_PATH
from the binstub.
@idoprz will ping you
Hope this helps.
@DanSchlachter FYI
I found a solution to detect the properly used @sap/cds-dk
version - with this I now have all in my hand to control the behavior of the build plugin.
See #1047
The version 0.9.6
is available soon.
@sammok83 @devinea - please retry
@petermuessig Tried cds w --profile hybrid and got this error:
Ok - this should be the last thing to fix... THX for being my CAP testers - and sorry for all that trouble... 😉
@sammok83 I'm releasing 0.9.7
now - this should hopefully do the final trick now. Please let me know whether it now fully works. Learned a lot this time how to identify the running binary and how to resolve the version of it - since it is hard to identify the version of the @sap/cds-dk
which is used to run the plugin.
@sammok83 @devinea - so, the latest version is available and should be bullet-proof: cds-plugin-ui5@0.9.7
is the one to test... 🤞
@petermuessig Thanks for all the hard work on this one.
Still not working unfortunately.
user: btp-lcnc-capex $ npm run watch-project1
> capex@1.0.0 watch-project1
> cds watch --open project1/index.html?sap-ui-xx-viewCache=false --livereload false
cds serve all --with-mocks --in-memory?
___________________________
[cds-plugin-ui5] [info] Running cds-plugin-ui5@0.9.7 (@sap/cds-dk@8.0.3, @sap/cds@8.0.4)
[cds-plugin-ui5] [warn] !! Multiple versions of @sap/cds loaded !!
[cds-plugin-ui5] [warn] => /home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js
[cds-plugin-ui5] [warn] => /managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js
[cds] - loaded model from 5 file(s):
app/services.cds
app/project1/annotations.cds
srv/service.cds
db/schema.cds
node_modules/@sap/cds/common.cds
[cds] - connect using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to db > sqlite { url: ':memory:' }
> init from db/data/sap.ui.lcnc-CapexType.csv
> init from db/data/sap.ui.lcnc-Capex.csv
> init from db/data/sap.ui.lcnc-BusinessUnits.csv
> init from db/data/sap.common-Currencies_texts.csv
> init from db/data/sap.common-Currencies.csv
> init from db/data/sap.common-Countries.csv
/> successfully deployed to in-memory database.
[cds] - using auth strategy { kind: 'dummy', impl: 'node_modules/@sap/cds/lib/auth/dummy-auth' }
[cds] - serving MainOnlineService { path: '/serviceonline' }
-----------------------------------------------------------------------
WARNING: Package '@sap/cds' was loaded from different installations: [
'/home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js',
'/managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js'
] Rather ensure a single install only to avoid hard-to-resolve errors.
-----------------------------------------------------------------------
[cds] - server listening on { url: 'http://localhost:4004' }
[cds] - launched at 7/23/2024, 7:51:16 AM, version: 7.9.4, in: 496.154ms
[cds] - [ terminate with ^C ]
^C
[cds] - my watch has ended.
user: btp-lcnc-capex $
@devinea - but this seems to be another issue related to @sap/cds-dk
(Cc: @chgeo)
It doesn't report a failure by cds-plugin-ui5
it is more stopping because of cds watch
isn't coming up properly...
-----------------------------------------------------------------------
WARNING: Package '@sap/cds' was loaded from different installations: [
'/home/user/projects/btp-lcnc-capex/node_modules/@sap/cds/lib/index.js',
'/managed-content/globals/pnpm/5/.pnpm/@sap+cds@8.0.4_express@4.19.2/node_modules/@sap/cds/lib/index.js'
] Rather ensure a single install only to avoid hard-to-resolve errors.
-----------------------------------------------------------------------
But here @chgeo and the CAP team need to help - this is out of responsibility of the cds-plugin-ui5
@petermuessig Have you seen my analysis above?
@chgeo - missed that one - good to know - so @devinea this is then on BAS side to fix
In general, the build issue should be gone now with the latest release of the cds-plugin-ui5
. Closing for now...
Describe the bug We are using
cds-plugin-ui5
and we where runningmbt build
and where greeted with an error today (15-07-2024). It was working before, the last time we tried it was 11-07-2024 and it worked (locally and via the azure pipeline).After a lot of trying we found it's because of this command in our mta.yaml:
- npx -p @sap/cds-dk cds build --production
when we change it to- npx -p @sap/cds-dk@7 cds build --production
, notice the@7
aftercds-dk
package it builds with success.We got the same error in our azure devops pipeline, luckily we could recreate locally.
To Reproduce Steps to reproduce the behavior:
MTA
application, it consist of cds module and a fiori module with an mta.yaml filembt build
command and we got an error.Expected behavior A successful
mbt build
with @sap/cds-dk@8.Desktop (please complete the following information):
inxi
Additional context Is this the right place to report this issue or does this need to be reported via SAP for me and make a case of it? If you need more information, let me know!