magento - 在自定义模块 Magento2.4.0 中出现奇怪的错误
问题描述
我在 Magento 2.4.0 中安装了一个自定义模块,但是当我尝试从后端访问它时,我遇到了奇怪的错误。
1 exception(s):
Exception #0 (InvalidArgumentException): Either remote URL or hashable content is required to whitelist
解决方案
这是由于试图将资产标签呈现给没有 url 或哈希的页面造成的。
如果你多读一点堆栈跟踪,你应该知道问题出在哪里。
在我们的例子中,我们Ebizmarts_Mailchimp
安装了模块。这是一个例外:
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 Magento\Csp\Helper\InlineUtil\Proxy->processTag() called at [vendor/magento/framework/View/Helper/SecureHtmlRenderer.php:67]
#2 Magento\Framework\View\Helper\SecureHtmlRenderer->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 Magento\Framework\View\TemplateEngine\Php->render() called at [vendor/magento/framework/View/Element/Template.php:273]
#5 Magento\Framework\View\Element\Template->fetchView() called at [vendor/magento/framework/View/Element/Template.php:303]
#6 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1111]
...
注意vendor/mailchimp/mc-magento2/view/frontend/templates/mailchimpjs.phtml:8
at 行#2
我们的解决方法是应用这个补丁
如果你安装了cweagans/composer-patches,你可以把它添加到你的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"
}
}
}
然后运行composer install --no-dev
并刷新缓存。
推荐阅读
- palantir-foundry - 如何将 Slate 查询的返回格式从列更改为行?
- java - 需要帮助来停止我的 Java Swing GUI 计时器?
- postgresql - Keycloak + postgresql 配置
- python - 将函数应用于特征,张量是不可散列的。相反,使用 tensor.ref() 作为键
- authentication - 如何验证谷歌服务帐户凭据
- reactjs - React Quill Jest 更改文本值
- javascript - 如何在某些 url 上禁用 body parser json 和 urlencoded?
- python - 从数据框中删除具有特定值的连续重复项
- class - 如何正确连接类与依赖项?
- python - python 是否不再在每次更新时覆盖 py.exe?