Search code examples
phpzend-framework2acllaminas-api-tools

How can I resolve Fatal Error:Uncaught exception with Resource not found in ZF2 Apigility?


Fatal error: Uncaught exception 'Zend\Permissions\Acl\Exception\InvalidArgumentException' with message 'Resource 'welcome' not found' in /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/Permissions/Acl/Acl.php on line 292
 Zend\Permissions\Acl\Exception\InvalidArgumentException: Resource 'welcome' not found in /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/Permissions/Acl/Acl.php on line 292
 Call Stack: 0.0001 627128
 1. {main}() /home/prateek.parekh/catalystapi/public/index.php:0 0.0257 720168 
 2. Zend\Mvc\Application::init() /home/prateek.parekh/catalystapi/public/index.php:56 1.2016 3360648
 3. Zend\Mvc\Application->bootstrap() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:260 1.3708 3632792
 4. Zend\EventManager\EventManager->trigger() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:156 1.3710 3633136
 5. Zend\EventManager\EventManager->triggerListeners() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:207 1.5567 3955048
 6. call_user_func:{/home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468}() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468 1.5568 3955080
 7. Application\Module->onBootstrap() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468 1.7301 4243984
 8. Catalyst\Permissions\Plugin\AclPlugin->doAuthorization() /home/prateek.parekh/catalystapi/module/Application/Module.php:29 1.7531 4246600
 9. Zend\Permissions\Acl\Acl->isAllowed() /home/prateek.parekh/catalystapi/vendor/catalyst/Catalyst/Permissions/Plugin/AclPlugin.php:48 1.7534 4246696
 10. Zend\Permissions\Acl\Acl->getResource() /home/prateek.parekh/catalystapi/vendor/zendframework/zendframework/library/Zend/Permissions/Acl/Acl.php:731 

Can someone guide me as to what is the logical step to solve this? I tried disabling doAuthorization($e) in Application/Module.php.


Solution

  • Adding

    'ZF\\Apigility\\Welcome'
    

    to application.config.php 'modules' array will solve this issue provided

    'ZF\Apigility\Welcome'
    

    is present in development.config.php