on 2024 Oct 25 4:10 PM
When adding a UI app with the SAP Fiori generator, I encountered an error stating, "The service metadata is invalid."
SAP Fiori generator
Console messages in the developer tool.
services.cds
using {my} from '../db/schema';
service MyService {
entity Foo as projection on my.Foo;
}
schema.cds
namespace my;
entity Foo {
key ID : Integer;
value : String;
}
I'm not sure what metadata this message refers to. The error occurred while following the tutorial at this SAP path.
To reproduce the issue, I created an empty project using cds init projectname, added a services.cds file under the srv path, and defined a simple service. Despite this, the same error still appears.
I've tried reinstalling plugins and even reinstalled VS Code, but nothing has worked so far.
Could you suggest where else I should check?
I'm working on macOS and VS Code, both updated to the latest versions.
Thank you.
Request clarification before answering.
I have resolved the issue.
After adding the following configuration to package.json and restarting VS Code, it started working correctly.
"cds": {
"requires": {
"db": {
"kind": "sqlite",
"credentials": {
"database": ":memory:"
}
}
}
}
Restarting VS Code was necessary to fix the issue.
However, this seems to be a workaround, so there still appears to be an underlying problem. It looks like the plugin needs improvement.
When the issue occurred, I checked the logs and found the following type-related error:
[2024-10-27 22:54:36] ERROR: An error occurred reading CAP service metadata: FooService. See log for more details.
[2024-10-27 22:54:36] ERROR: Error: Error while reading CAP service metadata. Path: '/Users/cothe/VSCodeProjects/SAP/sample2', service uri: '/odata/v4/foo/', error: 'TypeError: Cannot read properties of undefined (reading 'includes')'}
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is such a strange issue, and I hope it gets resolved soon.
If there is a database setting defined in a higher-level (high-priority) configuration file, try deleting it, leaving only the sqlite section in package.json. Then, restart VS Code and try again.
In my case, I had provided the DB connection info in .cdsrc-private.json, and it stopped working, so I deleted it and tried again, which made it work.
This is truly odd. I really hope it gets fixed soon.
ref @JulianZankl
@cap-js/asyncapi: 1.0.2
@cap-js/db-service: 1.14.1
@cap-js/openapi: 1.0.5
@sap/cds: 8.4.1
@sap/cds-compiler: 5.4.2
@sap/cds-dk: 8.1.2
@sap/cds-dk (global): 8.3.0
@sap/cds-fiori: 1.2.7
@sap/cds-foss: 5.0.1
@sap/cds-mtxs: 2.0.5
@sap/eslint-plugin-cds: 3.0.4
Node.js: v20.15.0
CAP Java SDK: 3.2.0
cds4j: 3.2.0
Spring Boot: 3.3.3
Maven: 3.9.9
Java: 21.0.3(Eclipse Adoptium) for windows, 21.0.5(sapjvm) for mac
OS: Windows 11, 10.0, arch: amd64
Max OS X, 15.0.1, arch: aarch64
SAP Cloud Application Programming Model
User | Count |
---|---|
75 | |
30 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.