Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
456 stars 603 forks source link

Not able to publish context aware configuration #3440

Open mnshh opened 1 month ago

mnshh commented 1 month ago

Required Information

Expected Behavior

Context aware configuration should be published and redirects added to it should work in Publish.

Actual Behavior

all redirects which are being added to /conf/global/settings/redirects is working fine in publish when published. Context aware configuration is not however.

logs: 2024/09/28 06:13:39:234 - INFO - Request accepted with distribution package PackageMessage(pubSlingId=a06abea1-ae79-4316-98b4-08daa75fe759, reqType=ADD, pkgId=dstrpck-1727504019153-aef3e5fe-7df8-45e8-a280-f3b12f6d5255, pkgType=journal_filevault, pkgLength=4672, pubAgentName=publish, userId=replication-service, paths=[/conf/xyz/settings/redirects], deepPaths=[], metadata={}) at offset=14648888, queueSize=1, queueSizeDelay=0 2024/09/28 06:13:50:793 - INFO - Successfully applied package with id dstrpck-1727504019153-aef3e5fe-7df8-45e8-a280-f3b12f6d5255, type ADD, paths [/conf/xyz/settings/redirects]

Steps to Reproduce

Open Redirect Manager --> Add redirects to context aware configuration (/conf/xyz) --> Change tab to Publish -> Publish

Links

Links to related assets, e.g. content packages containing test components

YegorKozlov commented 1 month ago

Did you add the cq:confproperty to your content tree and publish it? AEM performs a lookup based on the content and its contextual cq:conf property to find the appropriate configuration, e.g.

/content/xyz
    + jcr:content
      - cq:conf = "/conf/xyz"

/conf/xyz
    + settings
      + redirects
        + rule-1
            - source = "/content/xyz/page1"
            - target = "/content/xyz/page2"
            - statusCode = 302
mnshh commented 1 month ago

Wait, So cq:conf property needs to be available at all pages and not just root page? Then i need to add it at Template?

YegorKozlov commented 1 month ago

Wait, So cq:conf property needs to be available at all pages and not just root page? Then i need to add it at Template?

No, it needs to be on the root page only. Just make sure the root page is published.

I tested redirects in AEM CS 2024.6.16971.20240628T122619Z-240600 and 6.5.21 and all was working fine for me.

mnshh commented 1 month ago

i manually added cq:conf property at a specific page(other than the root page) and then it works. my root page has it already.

YegorKozlov commented 1 month ago

It could be something wrong with your content tree. You only need cq:conf on the root page and that page needs to be published. CAconfig goes up the tree until this property is found.

You can use the "Sling / Context-Aware Configuration" plugin in the OSGi Console to test resolution and print the metadata.

image
mnshh commented 1 month ago

I dont see any issue there. Everything looks fine as the metadata above.

YegorKozlov commented 1 month ago

are you checking on the publish instance?

mnshh commented 1 month ago

In my local it works when i created a new replication agent. I am facing this issue in AEM Cloud. I have the same content hierarchy. I could also see that sling distribution logs as mentioned above.