on 07-09-2020 4:20 PM
Hi All,
When importing a service definition with cds import
and running cds watch
, then sometimes mocking for the imported service is not working. Actually, it seems to be an alternating issue. Restarting the watch-server in sequence, let mocking be active/no-active in an alternating way ...
Is anyone making the same observation?
I'm running Windows with:
>> cds -v
@sap/cds: 3.34.2
@sap/cds-compiler: 1.26.2
@sap/cds-dk: 1.8.5
@sap/cds-foss: 1.2.0
@sap/cds-reflect: 2.11.0
@sap/cds-runtime: 1.2.2
Node.js: v12.16.3
home: C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\node_modules\@sap\cds
prod-cat: 1.0.0
Regards,
Hi David,
It's really funny.
No, credentials are stable in package.json:
"cds": {
"requires": {
"API_BUSINESS_PARTNER": {
"kind": "odata",
"model": "srv\\external\\API_BUSINESS_PARTNER"
}
}
}
Starting ``cds watch`` for the first time leads to:
>> cds watch [cds] - running nodemon... --ext cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml --exec cds serve all --with-mocks --in-memory?
[cds] - model loaded from 3 file(s): db\schema.cds srv\admin-service.cds srv\external\API_BUSINESS_PARTNER.csn[cds] - using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to sqlite db { database: ':memory:' } > filling my.domain.OrderItems from db\data\my.domain-OrderItems.csv > filling my.domain.Orders from db\data\my.domain-Orders.csv > filling my.domain.Products from db\data\my.domain-Products.csv > filling my.domain.Suppliers from db\data\my.domain-Suppliers.csv/> successfully deployed to sqlite in-memory db
[cds] - mocking API_BUSINESS_PARTNER { at: '/api-business-partner' }
[cds] - serving AdminService { at: '/admin', impl: 'srv\\admin-service.js' }
[cds] - launched in: 2815.136ms[cds] - server listening on { url: 'http://localhost:4004' }
[ terminate with ^C ]
Stopping with ^C and restarting ``cds watch`` leads to:
>> cds watch [cds] - running nodemon... --ext cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml --exec cds serve all --with-mocks --in-memory?
[cds] - model loaded from 3 file(s): db\schema.cds srv\admin-service.cds srv\external\API_BUSINESS_PARTNER.csn[cds] - using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to sqlite db { database: ':memory:' } > filling my.domain.OrderItems from db\data\my.domain-OrderItems.csv > filling my.domain.Orders from db\data\my.domain-Orders.csv > filling my.domain.Products from db\data\my.domain-Products.csv > filling my.domain.Suppliers from db\data\my.domain-Suppliers.csv/> successfully deployed to sqlite in-memory db
[cds] - serving AdminService { at: '/admin', impl: 'srv\\admin-service.js' }
[cds] - launched in: 2702.617ms[cds] - server listening on { url: 'http://localhost:4004' }
[ terminate with ^C ]
So, the second time, no mocking happens. Stopping ``cds watch`` and restarting leads again to mocking mode, and so on ...
As usual, I can imagine that this is something special to Windows. Did you test this on Windows?
By the way: The generated entry in package.json:
"model": "srv\\external\\API_BUSINESS_PARTNER"
Wouldn't that path encoding with "\\" lead to problems when deploying to a Linux container on Cloud Foundry? But maybe this path isn't used at runtime ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi david.kunz2
Hope you don't think I'm crazy 🙂 but this is what I've found out in addition:
So there is something with 'cds watch' that after running it successfully with mocking, the next command (no matter whether it's 'cds watch' or 'cds serve all') results in no mocking.
Strange,
Regards
Hi Klaus,
I've never experienced this.
The command `cds watch` should only mock an external system if no credentials are provided, i.e. there is no `credentials` section in the `cds.requires.youExternalService`.
Can execute `cds env` to see if there are some credentials given?
Thanks and best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.