Expand my Community achievements bar.

What is the proper way to package content fragments

Avatar

Level 4

I have a project that uses content fragments to hold configuration information that is being exposed through servlets. The problem I am seeing is that if I create content fragments on my local and then create a package to deploy them to the develop environment for testing, because of versioning information the UI breaks and I am unable to modify them in the develop environment. The ugly part for me is that the versioning information for the content fragments is mixed in with all of the other assets that are versioned and I wouldn't want to mix that information into a package and cherry picking individual items would be VERY painful.

 

So my question is what would be the best way to package up content fragments into a CRX package that can be uploaded to the different environments and not break the UI so that they could be maintained after being deployed?

13 Replies

Avatar

Community Advisor

@Robert-Harper IMO, you can try to do a filter query in the system to find out all the content fragments in the system.

The SQL2 Query:

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/dam]) and s.[contentFragment] IS NOT NULL

For executing the query and getting the results in the Excel format you can leverage the ACS Commons Reports i.e., http://localhost:4502/apps/acs-commons/content/reports.html

The query can be done on the property as shown in the screenshot below i.e., contentFragment property.

shaileshbassi_1-1658167680269.png

 

The same can even we done via the code to create the package programmatically via hitting the custom servlet via the curl command, or via any other mode e.g., scheduler to create the packages at a regular time interval.

 

Hope this helps!

Thanks

Avatar

Level 4

I don't think you fully understand the issue. I know the variations are stored as children under the master. The issue is that there are version UUIDs and some other links to data that is stored in /var that doesn't get packaged when I set the filter to build the package on the original content fragments. Also, the information in /var is not organized by a path based on the master content but it is mixed in with all of the other version information for other assets.

Avatar

Community Advisor

I hope by versioning you mean the version of assets which can not be packaged from one environment to another.

https://experienceleague.adobe.com/docs/experience-manager-65/administering/contentmanagement/packag...

 

sachinarora_1-1658235753258.png

CRX2OAK tool provides the migration of version as well but I don't think that would be convenient in your case.  

https://experienceleague.adobe.com/docs/experience-manager-65/deploying/upgrading/using-crx2oak.html...

 

Please confirm which UI you are referring? Is it custom build or OOTB?

Avatar

Level 4

Okay. In attempt to be very clear. I create an instance of a content fragment. Content fragments are versioned. I don't create any new versions of any of the content fragments. There are UUIDs stored in the content fragment's metadata that point to elements under the /jcr:system/jcr:versionStorage root that are not automatically included in a package of the content.

Then when the package is uploaded to another host, I think the editor is attempting to reference the version UUID's in the metadata and fails because it wasn't in the package. There isn't an easy way to include the version information from the /jcr:system/jcr:versionStorage root because it isn't organized by the location of the assets. 

I am not using any custom UI. What I want to find out is how do I create a package of content fragments that were created on say a develop server that I can then upload to a QA, UAT, Stage, and maybe production instance and be able to edit the content at the upper levels.

Avatar

Level 4

Hopefully to clarify. I am having issues with content fragments that I create on one host and then using the package manager, create packages to transfer them to another host. I have used a package to update the target host with the content fragment models and enabled them in an asset folder. Next I create a package of the content fragment assets and use that package to upload the content fragments to the new host. Then when I attempt to edit the newly installed content fragments. the content fragment editor errors and I'm assuming it has to do with the versioning UUID's in the fragments' metadata not resolving in the new JCR.

If my assumption is correct, how do I include the versioning information with the assets? They are not organized in such a way that makes it easy to add all of them to the package because they are all mixed together with the versioning of other assets.

Avatar

Community Advisor

UUID is an unique identifier given to a node. There cant be any duplicate UUID in a repository. So if there is any issue with UUID, package manager wont let that node installed in AEM at first place and you will error while installing the package. 

Also if an asset has a version history then it will have properties like jcr:versionHistory,jcr:baseVersion.

Even if any asset does not have a version history, it will still has UUID.

Version is created so that Author can revert to old state of an asset when its needed or roll back scenario. AEM OOTB UI wont break because of this.

 

So I think you should check the issue in different direction. Please check if Content fragment model which is associated with Content Fragment is there in AEM. If possible please share logs or screenshot if issue.

Avatar

Level 4

The issue is that I created some content fragments on my local. I then created a package using the package manager and uploaded them to the develop instance. I then installed them and when I attempt to edit them in the develop instance, the UI errors. There were no extra versions, no other renditions, just the initial content. I also had to rebuild my local instance and used the saved version of the content fragments to recover them and I have the same issue in my local instance now.

I did create custom models but their definitions were installed before attempting to edit the content fragments I created from them. There are no customizations to the UI. Except for the models I created, everything else is OOTB.

Avatar

Community Advisor

Have you checked ACL privileges for everyone user? Do they have adequate permissions to view the resources?

Avatar

Level 4

In all cases I was logged in with the administrator account. Also, I had to rebuild my local instance and when I installed the package on my local, I am now experiencing the same issue there as well. I don't think the ACL is the issue.

Avatar

Level 1

hi Robert, what version of AEM are you running?

 

We do this with content fragments and have not seen any issues with migrating them to another system, we just loose the version history as the package only contains the current version.

 

Is anything logged in the console or server error logs when trying to open the fragment editor after importing?

 

Does the same issue occur in the opposite direction? e.g. if you create a fragment based on one of the installed models on the other system, then package it and install on your local?

 

Martin

Avatar

Level 4

I am running 6.5.0.

I also imported the same package I deployed to develop into a new instance on my local and see the same issue. When I click on the folders that contain the content fragments, there is a popup error that just says it failed to load the data. If I create a new folder, the new folder opens and new content fragment instances created under the newly created folder work and are editable.

If I drop down and manually change to one of the imported folders by appending the folder name to the URL in the address bar, it opens but the content fragments that are actually there are not displayed.

There are NullPointerExceptons thrown from the SlingRequestProcessorImpl class around attempting to java.lang.reflect.Array.newArray(). This exception is thrown on the content fragments as well as the folders.

Avatar

Adobe Champion

Are you able to share the full stack trace of the error in the logs?

 

Does the same happen if you pre-create the destination folder before installing the package? from the above it appears to relate to the import creating the folders to enable it to place content deeper in the tree.  

Can you check in crx/de to see if there is a difference in the jcr:primaryType of the manually created and imported folders?

 

I have tried this locally but cannot reproduce the issue, however i am currently on 6.5.11.