We encountered a problem very similar to your question. We started experiencing the issue once upgrading to 10.3 and CLI 5.1.25. In our case, the problem was caused by using a relative file path in defaultModuleRelativeSerializationPath
like ../../serialization
in the project's sitecore.json
file.
When using ser pkg create
this causes the package to construct a corrupted file path for serialized roles within the package (zip) file. Thus the roles are interpreted as empty by ser pkg install
, dropping all the roles afterward.
Package file created opened with WINRAR to see file contents
The solution for us was not very straight forward since:
- The construction with
pkg create
andinstall
ran apparently stable for a long time. - You can override file path serialization on the module level, however, you cannot do that for roles.
- Changing it in the root
sitecore.json
will cause issues for all modules.
We ended up adding a new sitecore.json
config file to the project. In there correcting the defaultModuleRelativeSerializationPath
to just "serialization" and moving the serialized roles into the folder where the actual module is located. Afterwards calling ser pkg installcreate
with the extra --config
parameter referencing the duplicated sitecore.json
file for installingcreating an itempackage just that module containing thefor roles.