cancel
Showing results for 
Search instead for 
Did you mean: 

XYZ is not allowed to override this storefront.

phoude
Participant

We have numerous JavaScript errors showing in the console which relates to this piece of code from webApplicationInjector.js. Any idea how to prevent this? As far as I know the webapplicationinjector must be included on every page in order to allow SmartEdit to work but it is causing the below issue on our web site.

window.addEventListener("message", (function(t) {
if (!r.default.isAllowed(t.origin, window, s))
throw new Error(t.origin + " is not allowed to override this storefront.");

Accepted Solutions (0)

Answers (1)

Answers (1)

adamreisberg
Active Participant
0 Kudos

Hi phoude

If working with SAP Commerce Cloud, Composable Storefront, please reference the following:

SmartEdit Integration | SAP Help Portal

Please follow the section Error Message: Not Allowed to Override This Storefront

phoude
Participant
0 Kudos

Using the accelerator storefront so it does not apply to my situation. I found this article too but it does not apply to my situation: https://me.sap.com/notes/0003364961. We do not have problems editing in SmartEdit. This error shows up on our public web site. Many 3rd parties calls are being intercepted by the code I provided in my initial post. For example we will have the following error shown in the console: https://www.paypal.com is not allowed to override this storefront. Do we have to conditionally load the webapplicationinjector somehow because the culprit code is found in that js file?

adamreisberg
Active Participant
0 Kudos

Hi phoude

I recommend against using SmartEdit in the "accstorefront" aspect (the public website) of your CCV2 instance.

Instead, utilize the Backoffice ("backoffice") aspect to load up your storefront and configure SmartEdit.

So the process would likely be:

  1. Remove "smarteditaddon" from your "accstorefront" aspect
  2. Enable SmartEdit and Storefront on your "backoffice" aspect (with the "smarteditaddon")
phoude
Participant
0 Kudos

I am not sure what you mean by removing the addon from one aspect and add it to the other. Are you referring to the webapps section inside each aspect? I don't have "smartedit" defined in my "accstorefront" aspect but only in my backoffice.

The only place where I have "smarteditaddon" defined in my manifest file is in the extensions section and storefrontAddons section.

We access SmartEdit only from the backoffice node.

The webapplicationinjector.js is present on our storefront hence it is there whether or not we are in the context of SmartEdit

adamreisberg
Active Participant
0 Kudos

Hi phoude

Alternative Solutioning Path

Based on the feedback here, this is what I'll recommend...

For only your storefront aspect in CCV2, do the following configuration:

smarteditaddon.javascript.paths.responsive=

This "unsets" the webapplicationInjector.js from being set on any requests to the "Storefront webapp" in the "accstorefront" aspect of your CCV2 configuration.

Do proceed with caution. If you are using SmartEdit from the "backoffice" aspect of your CCV2 instance to modify a "Storefront webapp" in the "accstorefront" aspect, this will break the SmartEdit contract. The solution above will only work if you have a "Storefront webapp" and the "SmartEdit webapp" running in the "backoffice" aspect of the CCV2 instance.

For more details on this solution see Permitting SmartEdit for Your Storefront | SAP Help Portal

phoude
Participant
0 Kudos

I have implemented the suggested configuration on my storefront aspect and it does not work. I don't know if you are using wro but if I have it enabled, the webapplicationinjector is included in addons_responsive.js. If I disable wro then it is not injected to my pages in the section where all the addons js files are listed. Disabling wro is not an option so I really want to find a way to make it work.

phoude
Participant
0 Kudos

For those using WRO, it is not possible to exclude smartedit from the storefront but include it in the backoffice aspect when using SmartEdit. So you have to do is exclude SmartEdit in the WRO file by settings the following properties in your project.properties file of your storefront.

<mystorefrontname>storefront.wro4jconfigscan.smarteditaddon=false
smarteditaddon.css.paths.responsive=
smarteditaddon.javascript.paths.responsive=

This will take care of exclude SmartEdit from addons_wro.xml which in turn ensure that it will not end up in your addons_responsive.js file

Then in the Backoffice aspect in CCV2 (whether via manifest or Properties tab of CCV2), you need to set the following:
smarteditaddon.css.paths.responsive=/responsive/common/css/smarteditaddon.css

smarteditaddon.javascript.paths.responsive=/shared/common/js/webApplicationInjector.js;/shared/common/js/reprocessPage.js;/shared/common/js/adjustComponentRenderingToSE.js;/responsive/common/js/smarteditaddon.js
storefront.wro4j.enabled=false

You will still get the error but at least it will not show up in the public storefront

adamreisberg
Active Participant
0 Kudos

Hi phoude

Thanks for posting an update here.