Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - @sap/fiori:app CLI generator fails at last step #1233

Closed
ghost opened this issue Aug 30, 2023 · 5 comments
Closed

BUG - @sap/fiori:app CLI generator fails at last step #1233

ghost opened this issue Aug 30, 2023 · 5 comments

Comments

@ghost
Copy link

ghost commented Aug 30, 2023

Description

Hi experts,

I am working at SAP and develop an application that uses the "Golden Path" stack.
I try to run the CLI generator @sap/fiori within VS code to create a fiori elements application with npx yo "@sap/fiori".
After the last prompt input it generates the app files, but then fails with the error message:
Error install phase deployment-generator:cf: Error: could not update the "/private/var/folders/vx/7fd0ynfs1ts777dfqgb9cz3h0000gn/T/2b3e3d5f4b292bca53a69bab09f66665.temp.mta.yaml" file; it was modified by another process.

I also checked my npm packages. The warn message (see below) regarding the missing library @sap/cds-dk is weird, because I have this installed as a devDependency.

As a second try I tried to install all needed npm packages globally. But when I saw that @sap/cds-dk is also needed as a global dependency, I stopped this.

Steps to Reproduce

Steps to reproduce the behavior (I obfuscated many details):

npx yo "@sap/fiori"         
? Template Type SAP Fiori
? Which template do you want to use? List Report Page
? Data source Use a Local CAP Project
? Choose your CAP project servicestoolchain
? OData service xxx.xxx.xxx.xxx.xxxService (Node.js)
? Main entity DummyEntity
? Module name dummyentity
? Application title Maintain DummyEntity
? Application namespace xxx.xxx.xxx.xxx.xxx
? Description A Fiori application.
? Minimum SAPUI5 version 1.108.21
? Add deployment configuration to MTA project (/Users/path/to/git/repo/mta.yaml) Yes
? Add FLP configuration Yes
? Configure advanced options No
? Please choose the target Cloud Foundry
? Destination name my-destination
? Semantic Object DummyEntity
? Action Maintain
? Title Maintain DummyEntity
? Subtitle (optional) 
[2023-08-30 12:05:09] WARN: The library @sap/cds-dk is not installed or the version  installed was not compatible (4.1.4 or higher)
    force package.json
   create app/dummyentity/ui5.yaml
   create app/dummyentity/package.json
   create app/dummyentity/webapp/Component.js
   create app/dummyentity/webapp/index.html
   create app/dummyentity/webapp/manifest.json
   create app/dummyentity/webapp/i18n/i18n.properties
   create app/dummyentity/webapp/localService/metadata.xml
   create app/dummyentity/webapp/test/flpSandbox.html
   create app/dummyentity/webapp/test/testsuite.qunit.html
   create app/dummyentity/webapp/test/testsuite.qunit.js
   create app/dummyentity/webapp/test/integration/opaTests.qunit.html
   create app/dummyentity/webapp/test/integration/opaTests.qunit.js
   create app/dummyentity/webapp/test/integration/pages/dummyentityList.js
   create app/dummyentity/webapp/test/integration/pages/dummyentityObjectPage.js
   create app/dummyentity/webapp/test/integration/FirstJourney.js
   create app/dummyentity/annotations.cds
    force app/services.cds
   create app/dummyentity/README.md

Changes to package.json were detected.

Running npm install for you to install the required dependencies.

up to date, audited 1594 packages in 2s

16 vulnerabilities (6 moderate, 10 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
Error install phase deployment-generator:cf: Error: could not update the "/private/var/folders/vx/7fd0ynfs1ts777dfqgb9cz3h0000gn/T/2b3e3d5f4b292bca53a69bab09f66665.temp.mta.yaml" file; it was modified by another process
    force app/dummyentity/webapp/manifest.json

Expected results

The fiori app is created, package.json and mta.yaml are updated correctly.

Actual results

The files are created, but an error is thrown and e.g. no package-lock.json was created within the new app folder.
The mta.yaml is also not updated.

Version/Components/Environment

OS: Mac OS 13.5.1
Node.js: 18.17.0
npm: 9.6.7
@sap/generator-fiori: 1.10.5
VS Code: 1.81.1

excerpt of the package.json file:

"dependencies": {
    "@dynatrace/oneagent-sdk": "1.5.0",
    "@sap-cloud-sdk/connectivity": "3.4.0",
    "@sap/audit-logging": "5.7.1",
    "@sap/cds": "7.1.2",
    "@sap/cds-fiori": "1.0.0",
    "@sap/cds-hana": "2.0.0",
    "@sap/xsenv": "4.0.0",
    "@sap/xssec": "3.3.3",
    "express": "4.18.2",
    "helmet": "7.0.0",
    "nodemailer": "6.9.4",
    "passport": "0.6.0",
    "socks": "2.7.1"
  },
  "devDependencies": {
    "@cap-js/sqlite": "0.2.0",
    "@sap/cds-dk": "7.1.1",
    "@sap/eslint-plugin-cds": "2.6.3",
    "@sap/ux-specification": "1.108.12",
    "@types/async-retry": "1.4.5",
    "@types/express": "4.17.17",
    "@types/jest": "29.5.4",
    "@types/node": "18.17.11",
    "@types/nodemailer": "6.4.9",
    "@types/sap__xsenv": "3.3.0",
    "@typescript-eslint/eslint-plugin": "6.4.1",
    "@typescript-eslint/parser": "6.4.1",
    "eslint": "8.48.0",
    "eslint-config-prettier": "9.0.0",
    "eslint-plugin-jest": "27.2.3",
    "eslint-plugin-sonarjs": "0.21.0",
    "jest": "29.6.4",
    "jest-junit": "16.0.0",
    "mta": "1.0.5",
    "prettier": "3.0.2",
    "rimraf": "5.0.1",
    "sqlite3": "5.1.6",
    "ts-jest": "29.1.1",
    "ts-node": "10.9.1",
    "tsc-watch": "6.0.4",
    "typescript": "5.2.2",
    "yo": "4.3.1"
  },

Root Cause Analysis

Problem

{describe the problem}

Fix

{describe the fix}

Why was it missed

{Some explanation why this issue might have been missed during normal development/testing cycle}

How can we avoid this

{if we don’t want to see this type of issues anymore what we should do to prevent}

@quiggs1001
Copy link

Hi @keshix2k6

Thanks for reaching out, sorry you're having this issue. Firstly, @sap/cds-dk does need to be installed globally for CAP support, this is a limitation on the CDS library, and not something Fiori tools can resolve. It is also included as a dev dependency as it's used for compilation of the CAP project.

For your second issue, I have also tried this scenario today and didn't get a permissions error on the mta file. Can you please confirm the mta file is not already open in an existing editor? Or in use by some other tool?

Regards,
Ian

@ghost
Copy link
Author

ghost commented Aug 31, 2023

Hi @quiggs1001

I deleted the temp mta file and made sure that no other tool/editor uses it. It turns out that this temp file was generated because the generator failed in a previous run. So the real error message is:

[...]
Changes to package.json were detected.

Running npm install for you to install the required dependencies.

up to date, audited 1594 packages in 2s

16 vulnerabilities (6 moderate, 10 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
Adding app to mta config: saptoolsservicesinventoryappqualitystatements
Error install phase deployment-generator:cf: Error: [2023-08-31 10:29:30]  INFO get parameters
unexpected fault address 0x360808085a175a75
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x360808085a175a75 pc=0x102d1e1e0]

goroutine 1 [running]:
runtime.throw({0x102fcfca8?, 0xa900014000229b58?})
        /usr/local/go/src/runtime/panic.go:992 +0x50 fp=0x140001df590 sp=0x140001df560 pc=0x102cf2020
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:825 +0x1a4 fp=0x140001df5c0 sp=0x140001df590 pc=0x102d08144
aeshashbody()
        /usr/local/go/src/runtime/asm_arm64.s:885 +0x2d0 fp=0x140001df5d0 sp=0x140001df5d0 pc=0x102d1e1e0
runtime.mapiternext(0x140005b5fc0)
        /usr/local/go/src/runtime/map.go:934 +0x2c4 fp=0x140001df640 sp=0x140001df5d0 pc=0x102cced14
runtime.mapiterinit(0x10333b8c0?, 0x515dafc53a698252?, 0x0?)
        /usr/local/go/src/runtime/map.go:861 +0x2f0 fp=0x140001df670 sp=0x140001df640 pc=0x102ccea10
reflect.mapiterinit(0x14000229c30?, 0x14000229ba0?, 0x14000171101?)
        /usr/local/go/src/runtime/map.go:1373 +0x20 fp=0x140001df6a0 sp=0x140001df670 pc=0x102d1b380
github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeIterate(...)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/modern-go/reflect2/unsafe_map.go:112
github.com/json-iterator/go.(*mapEncoder).Encode(0x140001617a0, 0x14000229778, 0x14000192360)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect_map.go:257 +0x238 fp=0x140001df760 sp=0x140001df6a0 pc=0x102f12a98
github.com/json-iterator/go.(*OptionalEncoder).Encode(0x1030760e0?, 0x140001b4820?, 0x0?)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect_optional.go:70 +0xcc fp=0x140001df7c0 sp=0x140001df760 pc=0x102f1869c
github.com/json-iterator/go.(*onePtrEncoder).Encode(0x140001711d0, 0x14000229778, 0x14000161650?)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect.go:219 +0x8c fp=0x140001df800 sp=0x140001df7c0 pc=0x102f0b92c
github.com/json-iterator/go.(*Stream).WriteVal(0x14000192360, {0x1030760e0, 0x14000229778})
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect.go:98 +0x174 fp=0x140001df880 sp=0x140001df800 pc=0x102f0acf4
github.com/json-iterator/go.(*dynamicEncoder).Encode(0x140001df801?, 0x14000192378?, 0x140001df928?)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect_dynamic.go:15 +0x40 fp=0x140001df8b0 sp=0x140001df880 pc=0x102f0d290
github.com/json-iterator/go.(*structFieldEncoder).Encode(0x14000161500, 0x10306cc28?, 0x14000192360)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect_struct_encoder.go:110 +0x58 fp=0x140001df930 sp=0x140001df8b0 pc=0x102f1fa28
github.com/json-iterator/go.(*structEncoder).Encode(0x140001615c0, 0x1030f6d50?, 0x14000192360)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect_struct_encoder.go:158 +0x708 fp=0x140001dfa20 sp=0x140001df930 pc=0x102f203a8
github.com/json-iterator/go.(*Stream).WriteVal(0x14000192360, {0x1030b8de0, 0x140001610b0})
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/reflect.go:98 +0x174 fp=0x140001dfaa0 sp=0x140001dfa20 pc=0x102f0acf4
github.com/json-iterator/go.(*frozenConfig).Marshal(0x140001b4820, {0x1030b8de0, 0x140001610b0})
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/config.go:299 +0x88 fp=0x140001dfb40 sp=0x140001dfaa0 pc=0x102f020a8
github.com/json-iterator/go.Marshal({0x1030b8de0?, 0x140001610b0?})
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/json-iterator/go/adapter.go:34 +0x48 fp=0x140001dfb70 sp=0x140001dfb40 pc=0x102ef76c8
github.com/SAP/cloud-mta/mta.printResult({0x1030760e0?, 0x14000229778?}, {0x0?, 0x1?, 0x1?}, 0x3000100?, {0x0?, 0x0?}, 0x1030f0e68, 0x1030f10a8)
        /home/circleci/go/src/github.com/SAP/cloud-mta/mta/mta_services.go:482 +0x27c fp=0x140001dfcb0 sp=0x140001dfb70 pc=0x102f3fa8c
github.com/SAP/cloud-mta/mta.WriteResult(...)
        /home/circleci/go/src/github.com/SAP/cloud-mta/mta/mta_services.go:467
github.com/SAP/cloud-mta/mta.RunAndWriteResultAndHash({0x102fd2f66?, 0x102e2f4b4?}, {0x16d13ea5d, 0x67}, {0x0?, 0x0, 0x0?}, 0x1030f0ea8)
        /home/circleci/go/src/github.com/SAP/cloud-mta/mta/mta_services.go:514 +0x104 fp=0x140001dfd60 sp=0x140001dfcb0 pc=0x102f3fe84
github.com/SAP/cloud-mta/cmd.glob..func10(0x10332fd60?, {0x140001c6820?, 0x2?, 0x2?})
        /home/circleci/go/src/github.com/SAP/cloud-mta/cmd/mta.go:220 +0x58 fp=0x140001dfdb0 sp=0x140001dfd60 pc=0x102fcd968
github.com/spf13/cobra.(*Command).execute(0x10332fd60, {0x140001c67e0, 0x2, 0x2})
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/spf13/cobra/command.go:852 +0x4c4 fp=0x140001dfe90 sp=0x140001dfdb0 pc=0x102e2f634
github.com/spf13/cobra.(*Command).ExecuteC(0x1033318e0)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/spf13/cobra/command.go:960 +0x34c fp=0x140001dff50 sp=0x140001dfe90 pc=0x102e2fb8c
github.com/spf13/cobra.(*Command).Execute(...)
        /home/circleci/go/src/github.com/SAP/cloud-mta/vendor/github.com/spf13/cobra/command.go:897
github.com/SAP/cloud-mta/cmd.Execute(...)
        /home/circleci/go/src/github.com/SAP/cloud-mta/cmd/root.go:33
main.main()
        /home/circleci/go/src/github.com/SAP/cloud-mta/main.go:11 +0x2c fp=0x140001dff70 sp=0x140001dff50 pc=0x102fcee9c
runtime.main()
        /usr/local/go/src/runtime/proc.go:250 +0x250 fp=0x140001dffd0 sp=0x140001dff70 pc=0x102cf4560
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1270 +0x4 fp=0x140001dffd0 sp=0x140001dffd0 pc=0x102d21144
    force app/qualitystatements/webapp/manifest.json

This is thrown after the app files are created.
Do you have an idea why this happens?

Regards,
Jan

@longieirl
Copy link
Contributor

As regards your segmentation violation exception, please refer to this issue SAP/cloud-mta#287

@ghost
Copy link
Author

ghost commented Aug 31, 2023

Hi @longieirl
thanks a lot for the hint! I downgraded my mta package to 1.0.4 and now its working again.

@ghost ghost closed this as completed Aug 31, 2023
@longieirl
Copy link
Contributor

Yes, the issue is with 1.0.5, the fix is to downgrade the verison;

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants