SAP Knowledge Base Article - Preview

3685068 - Error during request to remote service: Request failed with status code 404

Symptom

  • Access CAP service hitting error like:
    {"error":{"message":"Error during request to remote service: Request failed with status code 404","code":"502","@Common.numericSeverity":4}}
  • Http trace shows, example:

    request:
    Request URL
    http://localhost:4002/odata/v4/catalog/Books 
    Request Method
    GET
    Status Code
    502 Bad Gateway

    response:
    {
        "error": {
            "message": "Error during request to remote service: Request failed with status code 404",
            "code": "502",
            "@Common.numericSeverity": 4
        }
    }

  • Server side output or Server side log error, example:

    [odata] - GET /odata/v4/catalog/Books
    [cds] - connect to sap.capire.bookshop.a.CatalogService > odata { url: 'http://localhost:4001/odata/v4/catalogX' }
    [remote] - Error: Error during request to remote service: Request failed with status code 404
        at module.exports.run (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\utils\client.js:196:31)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async RemoteService.on_handler (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\Service.js:279:20)
        at async next (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:57:17)
        at async RemoteService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:55:10)
        at async RemoteService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\Service.js:301:12)
        at async CatalogService.<anonymous> (C:\CAP\namespace\serviceB\srv\cat-service.js:6:13)
        at async next (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:57:17)
        at async CatalogService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:55:10) {
      statusCode: 502,
      reason: AxiosError: Request failed with status code 404
          at settle (C:\CAP\namespace\serviceB\node_modules\axios\dist\node\axios.cjs:2106:12)
          at IncomingMessage.handleStreamEnd (C:\CAP\namespace\serviceB\node_modules\axios\dist\node\axios.cjs:3491:11)
          at IncomingMessage.emit (node:events:530:35)
          at endReadableNT (node:internal/streams/readable:1696:12)
          at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
          at Axios.request (C:\CAP\namespace\serviceB\node_modules\axios\dist\node\axios.cjs:4731:41)
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
          at async module.exports.run (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\utils\client.js:190:16)
          at async RemoteService.on_handler (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\Service.js:279:20)
          at async next (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:57:17)
          at async RemoteService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:55:10)
          at async RemoteService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\libx\_runtime\remote\Service.js:301:12)
          at async CatalogService.<anonymous> (C:\CAP\namespace\serviceB\srv\cat-service.js:6:13)
          at async next (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:57:17)
          at async CatalogService.handle (C:\CAP\namespace\serviceB\node_modules\@sap\cds\lib\srv\srv-dispatch.js:55:10) {
        message: 'Error during request to remote service: Request failed with status code 404',
        code: 'ERR_BAD_REQUEST',
        config: {
          timeout: 0,
          xsrfCookieName: 'XSRF-TOKEN',
          xsrfHeaderName: 'X-XSRF-TOKEN',
          maxContentLength: -1,
          maxBodyLength: -1,
          method: 'get',
          baseURL: 'http://localhost:4001/odata/v4/catalogX',
          proxy: false,
          allowAbsoluteUrls: true,
          data: undefined
        }


Read more...

Environment

SAP CAP – node.js runtime

Product

CP PC APM SERVICE all versions

Keywords

502, 404, ERR_BAD_REQUEST, baseURL, Request failed with status code 404, AxiosError, Error during request to remote service , KBA , BC-XS-CDX-NJS , SAP CAP – node.js runtime , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.