I have using Magento 2.4.2 enterprise edition and install custom module after run command php bin/magento setup:upgrade and then run command php bin/magento setup:di:compile but facing error while run command php bin/magento setup:di:compile using custom module.

I have also tried some solutions like adding permission and remove var/* pub/static/* generated/* but the issue is not resolved.


Class OAuth\Common\Storage\Session does not exist                                                                                                                    
  Class Vendor\Module\Controller\Google\Login\Interceptor generation error: The requested class did not generate properly because the 'generated' directory permission is read-only. If --- after running the 'bin/Magento setup:di: compile' CLI command when the 'generated' directory permission is set to write --- the re  
  the quested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only.

Any help will be appreciated. Thanks!

2 Answers 2


Remove the /generated/code/* then run setup:di:compile

  • I have already removed /generated/code/* but not working. Commented Aug 17, 2021 at 12:02
  • Give permission to chmod 777 -R var pub generated folder.if it will help
    – user99630
    Commented Aug 17, 2021 at 12:08
  • Tried that solution but not works. Commented Aug 17, 2021 at 12:13
  • okay then check your env.php file if sessions are correctly set up there are either DB or files.
    – user99630
    Commented Aug 17, 2021 at 12:25

Fix the issue to add lusitanian/oauth package. actually lusitanian/oauth package was missing. added package via below command.

Command: composer require lusitanian/oauth

After run command issue has resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.