How to Upgrade to Version 4 of the SAP Cloud SDK for JavaScript
This document outlines changes introduced in version 4 of the SAP Cloud SDK and provides guidance for updating your project where needed. Some points highlight changes in default behavior rather than required actions.
- Update Your Project Dependencies
- Update to Node 22 or Newer
- Destination caching is enabled by default
iasToXsuaaTokenExchangeoption isfalseby default- Remove Deprecated Content
Update Your Project Dependencies
Search for occurrences of @sap-cloud-sdk/[some module] in your package.json files.
Replace the version numbers with ^4.
run npm install or similar to install the dependencies and update the lock file.
Running your tests or deploying your application might fail at this point if you need to adapt to any breaking changes. We recommend updating your applications in one commit or pull request and making sure everything still works using your existing test suite.
Update to Node 22 or Newer
All SAP Cloud SDK for JavaScript libraries now support node 22 (LTS) as the minimum node version.
If you are using a node version older than 22, update your runtime environment to a newer version.
On Cloud Foundry you can do this by setting the node engine in your package.json.
Destination caching is enabled by default
Destination caching while retrieving destinations via the destination service is now enabled by default.
This change affects the default behaviour of getDestination() method, getAllDestinationsFromDestinationService() method, generated client's execute() method and generic HTTP requests execution using executeHttpRequest().
To disable caching set useCache: false in the options, for example in execute() method:
.execute({ destinationName: 'DESTINATION', jwt: 'JWT', useCache: false })
iasToXsuaaTokenExchange option is false by default
Token exchange from IAS to XSUAA is now disabled by default.
Set iasToXsuaaTokenExchange to true explicitly if token exchange is expected.
This change affects the default behaviour of following functions
getDestination()getAllDestinationsFromDestinationService()getDestinationFromDestinationService()useOrFetchDestination()toDestinationNameUrl()buildHttpRequest()executeHttpRequest()executeHttpRequestWithOrigin()
and following methods of request builder
execute()executeRaw()url()
Remove Deprecated Content
@sap-cloud-sdk/connectivity- The
getAgentConfig()function is now asynchronous, thegetAgentConfigAsync()function has been removed. - The
destinationForServiceBinding()function has been removed, usegetDestinationFromServiceBinding()instead. - The
PartialDestinationFetchOptionstype has been removed, use eitherServiceBindingTransformOptionsorgetDestinationFromServiceBinding()function. - The
serviceToken()function no longer takesxsuaaCredentialsas part of theoptionsparameter. - The
parseDestination()function is no longer a public API. - The
DestinationForServiceBindingOptionsinterface has been renamed toDestinationFromServiceBindingOptions.
- The
@sap-cloud-sdk/odata-common- The
FunctionImportParameterstype has been removed, useOperationParametersinstead. - The
ODataFunctionImportRequestConfigconstant has been removed, useODataFunctionRequestConfiginstead. - The
FunctionImportParameterconstant has been removed, useOperationParameterinstead. - The
ActionFunctionImportRequestBuilderBaseconstant has been removed, useOperationRequestBuilderBaseinstead.
- The
@sap-cloud-sdk/odata-v2- The
ODataFunctionImportRequestConfigconstant has been removed, useODataFunctionRequestConfiginstead. - The
FunctionImportRequestBuilderconstant has been removed, useOperationRequestBuilderinstead.
- The
@sap-cloud-sdk/odata-v4- The
ODataFunctionImportRequestConfigconstant has been removed, useODataFunctionRequestConfiginstead. - The
ActionImportParameterclass has been removed, useOperationParameterinstead. - The
ActionImportParameterstype has been removed, useOperationParametersinstead. - The
FunctionImportRequestBuilderclass has been removed, useOperationRequestBuilderinstead. - The
BoundFunctionImportRequestBuilderclass has been removed, useOperationRequestBuilderinstead. - The
BoundActionImportRequestBuilderclass has been removed, useOperationRequestBuilderinstead. - The
ODataActionImportRequestConfigconstant has been removed, useODataActionRequestConfiginstead. - The
ODataBoundActionImportRequestConfigclass has been removed, useODataBoundActionRequestConfiginstead. - The
OdataBoundFunctionImportRequestConfigconstant has been removed, useODataBoundFunctionRequestConfiginstead. - The
ActionImportRequestBuilderclass has been removed, useOperationRequestBuilderinstead.
- The
@sap-cloud-sdk/resilience- The
circuitBreakerHttpconstant has been removed, usecircuitBreakerinstead.
- The
@sap-cloud-sdk/util- The
assocconstant has been removed, there is no replacement.
- The
@sap-cloud-sdk/mail-clientpackage has been removed in v4.- As an alternative, implement your own mail client by checking the v3 implementation and the SAP BTP documentation for using the TCP protocol for cloud applications.