Saturday, February 22, 2025

How to read and move files in cloud-hot-folder of SAP Commerce CCv2 (Hybris) ?

Few months ago, we have migrated our SAP Commerce (formally Hybris) to Patch 29 from the patch 27. We are updating patches bimonthly. So as mentioned in the release notes, we made the necessary changes and bumped up the version numbers in 'manifest.json' file and deployed the build on CCv2 environment. Everything seems to be working fine.

Luckily we haven't pushed it to Production as our internal testing was in progress, suddenly one fine day we have started facing issues with the builds, it has started failing with errors like below,


    After checking the build logs and we were clueless for some time, as the same code was working fine on the local (just like most of the times :-) ). After applying most of our troubleshooting skills on the play, we got a clue that the cloud-hotfolder-extensions zip version that we are using on local and the one that has been used by the CCv2 build system is different. Now we were not aware about any such compatibility metrics that we need to check before downloading and using cloud-hotfolder-extensions with the particular patch (Even today the only link that we are aware about is this: https://me.sap.com/notes/2817992, let us know in case you are aware about any other publicly available documentation link). Also there is no control of this zip files version that CCv2 build is going to use is in our hand, seems like SAP decides this in the backend. And possibly that was the root cause that they were using older version of this zip earlier and then at one fine day they have decided to bump the version which eventually led to our earlier-working-fine builds to started failing. 

    So we decided to open up a SAP case with their support team. After few conversations they got the root cause as mentioned earlier and asked us to provide us more details about how we are using the Azure Storage SDK and all that. They were majorly suspecting it because the SDK version got upgraded to v12 from v8, and it was major re-write from the Azure's side. So SAP has suggested to follow this link and adjust our custom code accordingly.

    Now let us understand the use-case a bit, before talking about the whole story about what we thought of an adjustments in imported library classes to complete re-write of the logic. So we are having a cronjob which runs on regular interval and moves a file (which is being pushed from the third-party service) from specific location in Azure BLOB storage to the hot-folder location. And after the introduction of Azure SDK v12, the same code which reads and moves the file from the cloud storage location is started failing. Now there is no official documentation available on the SAP's help portal which describes this changes in details. From SAP support side they have tried for some time and then suggested that since it's your custom code you need to figure it out on your own by following the office Azure documentation!

    So let's take a look on the older code first to understand how it was working with Commerce Patch 27 (or with Azure SDK v8),



    
    And then after going through multiple iterations and trying to understand the Azure documentation, we finally landed up in a working solution like below (obviously thanks chatGPT it didn't take too long :-)),



Couple of insights here,

- It would be better if SAP Commerce Cloud will provide the control over the cloud-hotfolder-extensions’ version, just like the separate integration patch version (or may be make it part of the same zip file).

- Or else if they want to continue controlling it from behind the scenes then there should be at least a notification when they change the version of it.

- The Azure's documentation which provides the reasoning of their architectural re-designing decision is worth reading: here.


No comments:

Post a Comment