Builds are failing in CCV2 because of changes in the builder logic

Nuray Fahri
1 min readSep 16, 2022

From yesterday(15.09.2022) our builds in CCv2 are failing because of recent changes from SAP in the builder logic. Error:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "charSequence" is null
at com.google.common.hash.AbstractHasher.putString(AbstractHasher.java:55)
at com.google.common.hash.AbstractHashFunction.hashString(AbstractHashFunction.java:44)
at de.hybris.ccv2.image.hash.generator.HashGeneratorUtils.getHashForString(HashGeneratorUtils.java:46)
at de.hybris.ccv2.image.hash.generator.DockerImageHashGenerator.getBaseImageHash(DockerImageHashGenerator.java:45)
at de.hybris.ccv2.image.hash.generator.JsAppsImagesHashGenerator.putImageSpecificHashData(JsAppsImagesHashGenerator.java:49)
at de.hybris.ccv2.image.hash.generator.DockerImageHashGenerator.generateHash(DockerImageHashGenerator.java:38)
at de.hybris.ccv2.image.ProjectDockerImage.generateHashCode(ProjectDockerImage.java:143)
at de.hybris.ccv2.image.ProjectDockerImage.getHash(ProjectDockerImage.java:48)
at de.hybris.ccv2.image.ProjectDockerImage.isAvailableInTargetRegistry(ProjectDockerImage.java:64)
at de.hybris.ccv2.task.EvaluateServicesAndImagesTask.printImagesInfo(EvaluateServicesAndImagesTask.java:50)
at de.hybris.ccv2.task.EvaluateServicesAndImagesTask.process(EvaluateServicesAndImagesTask.java:37)
at de.hybris.ccv2.Builder.runTask(Builder.java:255)
at de.hybris.ccv2.Builder.lambda$runTasks$5(Builder.java:222)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at de.hybris.ccv2.Builder.runTasks(Builder.java:217)
at de.hybris.ccv2.Builder.run(Builder.java:99)
at de.hybris.ccv2.Builder.main(Builder.java:55)

One possible workaround for the Storefronts which are based on Spartacus from SAP is:

To enable SSR as described on: https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/b2f400d4c0414461a4bb7e115dccd779/cd5b94c25a68456ba5840f942f33f68b.html?locale=en-US

Enabling SSR can affect the running system, so it’s not a quick change, it requires testing on lower environments, too.

As our storefront is based on React.js this workaround was not applicable for us. So, there is a second workaround:

Disabling hashing mechanism used by CCv2 to speed up build process.

Adding in js-storefront manifest.json:

{  "disableImageReuse": true,  "applications": [  {    "name": "app",    "path": "app"   }  ]}

Builds can take longer after this change, because the image is always generated, even if exactly the same image was generated formerly.

https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/1be46286b36a4aa48205be5a96240672/8e37fcc1b28c44559f9ce734bf8c406c.htm

I hope this will help others who face the same build issues.

--

--