magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento_Paypal module has dependency on Magento_Csp module

Open dverkade opened this issue 1 year ago • 12 comments

Preconditions and environment

  • Magento Open Source 2.4.7

Steps to reproduce

This file has a dependency on Magento_Csp: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Paypal/Model/Config.php#L9

However it's not listed in the modules module.xml.

Expected result

Do not use Magento_Csp in module, or declare it as a dependency in the module.xml

Actual result

When Magento_Csp is disabled product detail pages throw an error because of the missing dependency:

==> exception.log <== [2024-05-28T09:50:40.591031+00:00] main.CRITICAL: Error: Cannot instantiate interface Magento\Csp\Model\Collector\MergerInterface in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121 Stack trace: #0 vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() #1 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create() #2 vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get() #3 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create() #4 vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get() #5 vendor/magento/framework/ObjectManager/ObjectManager.php(73): Magento\Framework\ObjectManager\Factory\Compiled->create() #6 vendor/magento/module-paypal/Model/Config.php(642): Magento\Framework\ObjectManager\ObjectManager->get() #7 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Paypal\Model\Config->__construct() #8 vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() #9 vendor/magento/framework/ObjectManager/ObjectManager.php(59): Magento\Framework\ObjectManager\Factory\Compiled->create() #10 generated/code/Magento/Paypal/Model/ConfigFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create() #11 vendor/magento/module-paypal/Model/PayLaterConfig.php(46): Magento\Paypal\Model\ConfigFactory->create()

Additional information

As Magento_Csp module cannot be disabled with 2.4.7 as it is tightly integrated, this issue can be reproduced by disabling the Magento_Csp module in 2.4.6 and upgrade it to 2.4.7.

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

dverkade avatar May 28 '24 11:05 dverkade

Hi @dverkade. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar May 28 '24 11:05 m2-assistant[bot]

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar May 28 '24 11:05 m2-assistant[bot]

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar May 29 '24 07:05 m2-assistant[bot]

Hello @dverkade,

Thank you for the report and collaboration!

We were not able to reproduce this issue on 2.4.7 community edition and 2.4-develop. Because the Magento_Csp module is a required dependency in composer.json file of Paypal module. image

So whenever we try to disable Magento_Csp module it will throw below error:

Unable to change status of modules because of the following constraints:
Cannot disable Magento_Csp because modules depend on it:
Magento_Paypal: Magento_Paypal->Magento_Csp

Please let us know if we are missing something on this.

Thank you.

engcom-November avatar May 29 '24 08:05 engcom-November

@dverkade: I've created https://github.com/baldwin-agency/magento2-module-csp-shim last week, if you at the moment don't want to use the CSP module and want to have a working Magento 2.4.7 project.

hostep avatar May 29 '24 09:05 hostep

@hostep Thanks for adding this module!

leonhelmus avatar Jun 13 '24 11:06 leonhelmus

Hello @dverkade,

Thank you for the report and collaboration!

We were not able to reproduce this issue on 2.4.7 community edition and 2.4-develop. Because the Magento_Csp module is a required dependency in composer.json file of Paypal module. image

So whenever we try to disable Magento_Csp module it will throw below error:

Unable to change status of modules because of the following constraints:
Cannot disable Magento_Csp because modules depend on it:
Magento_Paypal: Magento_Paypal->Magento_Csp

Please let us know if we are missing something on this.

Thank you.

@engcom-November that's true, but if you already have the Magento_Csp module disabled you'll run into the error mentioned in the ticket description. I also get it when trying to view the payment methods in the admin config, and when trying to place an order.

NateSwanson7 avatar Jun 17 '24 14:06 NateSwanson7

@engcom-November getting similar error , currently we are not using CSP module

Error: Cannot instantiate interface Magento\Csp\Model\Collector\MergerInterface in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121

sprajapat770 avatar Jun 21 '24 08:06 sprajapat770

Hello @dverkade,

Thank you for the report and collaboration!

We are to to reproduce this issue with 2.4.6 and upgrading it to 2.4.7. Disabled the Magento_Csp module in 2.4.6 and after updating it to 2.4.7, we got the below error when opening frontend:

main.CRITICAL: Error: Cannot instantiate interface Magento\Csp\Model\Collector\MergerInterface in /opt/homebrew/var/www/magento246p5ce/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121

Hence confirming this issue.

Thanks.

engcom-November avatar Jun 21 '24 09:06 engcom-November

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12281 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jun 21 '24 09:06 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jun 21 '24 09:06 m2-assistant[bot]

:x: You don't have permission to export this issue.

github-jira-sync-bot avatar Jun 21 '24 10:06 github-jira-sync-bot

@magento I'm working on this

magentoabu avatar Dec 07 '24 07:12 magentoabu