skip to Main Content

I have installed a custom module in Magento 2.4.0 but when I try to access it from backend then I am getting below strange error.

1 exception(s):
Exception #0 (InvalidArgumentException): Either remote URL or hashable content is required to whitelist

2

Answers


  1. This is caused by something trying to render an asset tag to the page that doesn’t have a url or hash.

    If you read the stacktrace a bit more you should get an indication of where the issue is coming from.

    In our case we had the module Ebizmarts_Mailchimp installed.
    This was the exception:

    1 exception(s):
    Exception #0 (InvalidArgumentException): Either remote URL or hashable content is required to whitelist
    
    Exception #0 (InvalidArgumentException): Either remote URL or hashable content is required to whitelist
    <pre>#1 MagentoCspHelperInlineUtilProxy->processTag() called at [vendor/magento/framework/View/Helper/SecureHtmlRenderer.php:67]
    #2 MagentoFrameworkViewHelperSecureHtmlRenderer->renderTag() called at [vendor/mailchimp/mc-magento2/view/frontend/templates/mailchimpjs.phtml:8]
    #3 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:71]
    #4 MagentoFrameworkViewTemplateEnginePhp->render() called at [vendor/magento/framework/View/Element/Template.php:273]
    #5 MagentoFrameworkViewElementTemplate->fetchView() called at [vendor/magento/framework/View/Element/Template.php:303]
    #6 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1111]
    ...
    

    Notice the vendor/mailchimp/mc-magento2/view/frontend/templates/mailchimpjs.phtml:8 at line #2

    The fix for us was to apply this patch

    If you’ve got cweagans/composer-patches installed you can just add this to your composer.json

    "extra": {
        "patches": {
            "mailchimp/mc-magento2":{
                "Either remote URL or hashable content is required to whitelist": "https://raw.githubusercontent.com/zero1limited/magento2-patches/eb137aaaf90ffa86add6566116d08723b1acfc26/patches/Ebizmarts_Mailchimp_mailchimpjs.patch"
            }
        }
    }
    

    Then run composer install --no-dev and flush cache.

    Login or Signup to reply.
  2. keep it simple :

    override file mailchimpjs.phtml in path of ur theme : app/design/frontend/Luma/default/Ebizmarts_MailChimp/templates/mailchimpjs.phtml

    replace exist content by this :

    $url = $block->getJsUrl();
    if($url){
        $render = $block->getRender();
        echo $render->renderTag('script',['type'=>'text/javascript','src'=>$url],'',false);
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search