adobe / asset-share-commons

A modern, open-source asset share reference implementation built on Adobe Experience Manager (AEM)
https://opensource.adobe.com/asset-share-commons/
Apache License 2.0
88 stars 107 forks source link

Not getting user information because of Uncaught ReferenceError: ContextHub is not defined #465

Open Sayali-Kolhatkar opened 4 years ago

Sayali-Kolhatkar commented 4 years ago

ASC_error While accessing light.html page in Asset-Share-Common through dispatcher using our domain , its unable to fetch user profile. Also filters and other functionalities(share, download, cart, etc) are not working properly. PFA screenshot for the errors.

We have tried all the possible solutions available on https://adobe-marketing-cloud.github.io/asset-share-commons/ . Also we have gone through Github issues but still no luck. We are using AEM 6.3 and 6.5 versions. We are getting this error on both versions.

Please help us to solve this issue at the earliest. Thanks in advance.

davidjgonzalez commented 4 years ago
  1. Does this work on AEM Author?
  2. If you check the /content/asset-share-commons/en > Page Properties > Personalization > Context Hub Path, is it set to: /etc/cloudsettings/asset-share-commons/contexthub (and is this page published)
  3. Assume it is set, can you verify there is infact the contexthub definition at: /etc/cloudsettings/asset-share-commons/contexthub (and are they published)
  4. Does it work when you hit the site directly at AEM Publish?
  5. If it does work on AEM Publish but not via Dispatcher, then set your dispatcher logs to DEBUG, hit the page, and see what Dispatcher is rejecting and resolve those issues via the approriate allows rules.
Sayali-Kolhatkar commented 4 years ago
  1. Does this work on AEM Author? -Yes

If you check the /content/asset-share-commons/en > Page Properties > Personalization > Context Hub Path, is it set to: /etc/cloudsettings/asset-share-commons/contexthub (and is this page published) -path is set and page is published

Assume it is set, can you verify there is infact the contexthub definition at: /etc/cloudsettings/asset-share-commons/contexthub (and are they published) -Definition is present and we have not published /etc/cloudsettings/asset-share-commons/contexthub. Do we need to publish it?

Does it work when you hit the site directly at AEM Publish? Yes, working publish environment.

If it does work on AEM Publish but not via Dispatcher, then set your dispatcher logs to DEBUG, hit the page, and see what Dispatcher is rejecting and resolve those issues via the approriate allows rules. -We have tried allowing /etc/cloudsettings/asset-share-commons/contexthub in dispatcher, also we allowed /etc, /libs but still we are getting same errors. Functionally and user info is not working properly. Could you please provide us list of paths which we need to allow for asset-share-commoms in dispatcher. Also we will try to see dispatcher logs by setting log to DEBUG and we will share logs with you.

davidjgonzalez commented 4 years ago

@Sayali-Kolhatkar thanks for the info. You shouldn't have to publish /etc/cloudsettings/asset-share-commons/contexthub since its part of the ASC ui.apps package, and since AEM Publish direct access works, it means its not missing from Publish.

Make sure you have all the rules (and they arent being overridden) as instructed in: https://adobe-marketing-cloud.github.io/asset-share-commons/pages/getting-started/set-up/#dispatcher

If you ahve these allows you can do one of two things (or both)

If there are rules you need to add that aren't listed on the above docs page, please report them back to this Github issue so we can incorporate them in the docs!

Thanks

Sayali-Kolhatkar commented 4 years ago

Hello David, Thanks for your help. We have gone through the link you have provided but issue still persists.

Before allowing anything in dispatcher, we were getting below declined errors in dispatcher.log.

/etc.clientlibs/asset-share-commons/clientlibs/clientlib-dependencies.min.js /etc.clientlibs/asset-share-commons/clientlibs/clientlib-theme/semanticui-light.min.css /etc.clientlibs/asset-share-commons/clientlibs/clientlib-base.min.css /content/asset-share-commons/en/light.html /content/dam/asset-share-commons/en/site/Logo-light.png /etc.clientlibs/asset-share-commons/clientlibs/clientlib-contexthub/cart.min.js /content/dam/ASSET_PATH/asset.rendition for all assets

According to the link provided by you and some other references from github, we have allowed below paths including /etc*. Still we are getting above declined errors in dispatcher and same console errors .

ContextHub Calls:

/0101 { /type "allow" /glob "GET /home/users//profile/" }

Current User:

/0102 { /type "allow" /url "/libs/granite/security/currentuser.json" } // Asset Renditions requests /0103 { /type "allow" /method "GET" /path "/content/dam" /extension "renditions" } /0036 { /type "allow" /url "/etc/cloudsettings" } /0037 { /type "allow" /url "/etc/segmentation" } /etc/cloudsettings/asset-share-commons/contexthub /etc/notification/email/asset-share-commons

Note: We are not getting 404 in network tab. We are getting 304 for asset renditions and 200 only.

Could you please provide exact paths of below clientlibs in crx/de: /etc.clientlibs/asset-share-commons/clientlibs/clientlib-site.js /etc.clientlibs/asset-share-commons/clientlibs/clientlib-contexthub/cart.js /etc.clientlibs/asset-share-commons/clientlibs/clientlib-site/js/cart.js /etc.clientlibs/asset-share-commons/clientlibs/clientlib-theme/semanticui-light.js /etc.clientlibs/asset-share-commons/clientlibs/clientlib-base.js

Also please let us know if you have any other solution to solve this issue.

Thanks

Sayali-Kolhatkar commented 4 years ago

Could you please help us out to solve this asap as this has become critical issue and impacting our release .
Thanks