Skip to content

Connectivity: Application crashes due to unhandledRejection. Failed to fetch destination. #6068

Description

@mykhailo-klym

Describe the Bug

We use @sap-cloud-sdk/connectivity in our projects, and it seems like this library has some unawaited promises, because our application crashes from time to time.

This is what we're able to capture in our logs. Note: this is the entire stack that gets logged and there is no our application code in it, which means that the library runs something as a 'background' code. Moreover, the logger seems to print the error, which in this case is axios error, which also contains JWT!!!

Message:Failed to fetch destination.

StackTrace:
Failed to fetch destination. at fetchDestinationWithoutTokenRetrieval (/app/node_modules/.pnpm/@sap-cloud-sdk+connectivity@4.1.1/node_modules/@sap-cloud-sdk/connectivity/src/scp-cf/destination/destination-service.ts:168:11) 
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) 
at async DestinationFromServiceRetriever.getSubscriberDestinationService (/app/node_modules/.pnpm/@sap-cloud-sdk+connectivity@4.1.1/node_modules/@sap-cloud-sdk/connectivity/src/scp-cf/destination/destination-from-service.ts:493:35) 
Caused by: HTTP Response: Request failed with status code 404 "<html><body><h1>Resource not found</h1></body></html>"

Steps to Reproduce

We could not reproduce it locally; unfortunately, we observe it in production only, and since the call stack doesn't contain our code, this means that the library is doing something on its own which makes it super hard for us to track.

Expected Behavior

  • Unawaited promises must be handled so it doesn't lead to node application crashes.

Screenshots

No response

Used Versions

  • Node: v22.17.0
  • NPM 10.9.2
  • SAP Cloud SDK version: 4.1.1

Code Examples

No response

Log File

No response

Affected Development Phase

Production

Impact

Impaired

Timeline

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions