Closed rodpf closed 6 months ago
Hi @rodpf ,
can you please post the complete logs surrounding this request, the definition of your destination and what version of CAP and the SDK you're using?
Problem was using the port 443 (maybe in connection with plain HTTP?) in the destination's URL.
Hi Guys,
Everything works fine in BAS using proxy, application can READ the required information from S/4 On-Premise OData service without further issues, but after deploying the application it shows the error below:
"Error during request to remote service: \nRequest failed with status code 401","name":"AxiosError","stack":"AxiosError: Request failed with status code 401\n
{"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"method":"get","baseURL":"","url":"/sap/opu/odata/sap//?$select=Status&$top=1"},"code":"ERR_BAD_REQUEST","status":401},"id":"1141480","layer":"cds","component_type":"application","container_id":"","component_id":"","component_name":"-srv","...}
The destination is the same, both destination and connectivity services are bound with the application, I am using another on-premise SMTP destination (also via the same CC) and it is working fine.
This is how I am calling the backend:
`this.on('READ', 'ZENTITYSet', async (req) => {
In despite I am using cds.conenct directly, I undertand that it uses @sap-cloud-sdk/http-client to connect
This is the definition of the destination in package.json
"'backend_destination": { "kind": "odata-v2", "model": "srv/external/'backend_destination", "credentials": { "destination": "'backend_destination", "path": "/sap/opu/odata/sap/<Servicename>" }, -->tried with and without parameters below "external":true, "impl":"@sap/cds/libx/_runtime/remote/Service.js" }
What surprises me is the error, BAD_REQUEST and the same is not happening when running the project inside BAS, only when deploying the CAP application to BTP CF.Can you please advise? This is a productive project, SIT should start next week and there will be 5 consultants stopped if that cannot be fixed.
Thanks and regards