SAP-samples/btp-developer-guide-cap

Remote Service Mock - Working fine with local mock server when testing locally but not working after deploying to BTP

sammok83 opened this issue · 2 comments

I've done all all the steps and pre-requisites of
https://github.com/SAP-samples/btp-developer-guide-cap/blob/main/documentation/remote-service/remote-service-mock-cf.md

Tested Locally with the mock server and everything is working fine.
However after deploying it to CF on BTP, the connection to the external service (mock server) did not work. This when querying the Customer dropdown:
image

Error as below:
**--batch_id-1708430817172-490
content-type: application/http
content-transfer-encoding: binary

HTTP/1.1 502 undefined
odata-version: 4.0
content-type: application/json;odata.metadata=minimal;IEEE754Compatible=true

{"error":{"code":"502","message":"Error during request to remote service: \nRequest failed with status code 404"}}
--batch_id-1708430817172-490--**

Mock Server destination define and working fine:
image

Querying is working fine too with the URL defined in the destination:
image

Credentials defined in package.json:
image

Hi @sammok83
Please change the path in credential configuration in package.json.

"API_BUSINESS_PARTNER": {
                "kind": "odata-v2",
                "model": "srv/external/API_BUSINESS_PARTNER",
                "[production]": {
                    "credentials": {
                        "destination": "incidents-api-access",
                        "path": "/odata/v2/api-business-partner"
                    }
                }
            }

We have recently migrated the mock server to cap-js-community/odata-v2-adapter which requires this new path.
Documents will be updated soon.

Thanks works now