CSP module errors for 2.4.1

Hi

I installed the CSP module on Magento 2.4.1
server is Nginx

it returns this error ever after clearing cache and setup upgrade:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
DigitalStartup_Csp schema: current version - none, required version - 1.0.0
DigitalStartup_Csp data: current version - none, required version - 1.0.0

Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
DigitalStartup_Csp schema: current version - none, required version - 1.0.0
DigitalStartup_Csp data: current version - none, required version - 1.0.0
<pre>#1 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:75]
#2 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#3 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#4 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#5 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#6 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#7 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:263]
#8 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:40]

can you help please?

Thanks.

Did you run that after uploading the files?

Hi, yes I did. I discovered that elastic search was preventing setup:upgrade from working.
I finally got it enabled.
However, after editing the csp_whitelist file and clearing cache, I still get the content policy errors.

I am unable to access admin page. it loads continuously.

Run steps 1-10 in this post (https://digitalstartup.co.uk/t/how-to-prepare-magento-2-3-for-2-4/1812). I usually find these commands thoroughly flush everything during an install. Kind of like my “Holy Grail”.

If that fails, fall back to the original csp_whitelist.xml and double check your custom edits. And run in Report Only mode to see if you’ve addressed all the CSPs before Enforcing anything.

I’ve not tested this with 2.4.x, so if Magento core code now includes something extra then I’ll update the module to include a new rule default.

Hi,

Thanks. I went to the link but it gives this error ‘Oops! That page doesn’t exist or is private.’

I finally got it working by removing the existing header: add_header Content-Security-Policy “default-src ‘self’ http: https: data: blob: ‘unsafe-inline’” always; from my main website config.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.