03-21-2024 2:23 PM - edited 03-21-2024 2:29 PM
Hi all,
I have a BTP NodeJS application (A) which needs to make a REST call to another BTP application (B) at a regular interval.
In the mta.yaml file for app (A) I have specified the following resource which links to the exposed service of app (B):
- name: app_a_using_app_b_api
type: configuration
parameters:
provider-nid: mta
provider-id: <app B name>:<app B exposed service>
version: ">=0.0.0"
- name: app_a_srv
type: nodejs
path: .
requires:
- name: app_a_db
- name: app_a_using_app_b_api
group: destinations
properties:
forwardAuthToken: false
name: app_b_api
url: ~{url}
timeout: 30000
"cds": {
"requires": {
"middlewares": true,
"app_b_api": {
"kind": "destination",
"credentials": {
"destination": "app_b_api"
}
}
}
}
Within app (A), at a regular interval, the following function is then called:
async doRequestToAppB() {
try {
const destination = await getDestination({ destinationName: "app_b_api" });
const data = await executeHttpRequest(destination, {
method: 'GET',
url: "/api/ping"
});
logger.info(`Request OK: ${JSON.stringify(data)}`);
} catch (err) {
logger.error(`Request FAILED: ${err}`);
}
}
This request now fails with the following error in the catch-clause:
[app_a] - Request FAILED: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TLSSocket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
I have tried many ways, but somehow I don't seem to be able to have app (A) automatically do a request to app (B), failing with the above error...
I also tried to debug the executeHttpRequest function from within BAS, but that did not give me any clues either.
If anyone has any clues, ideas, directions or tips on how to solve this, that will be highly appreciated!
Thanks in advance,
Robin van het Hof
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.