laminas-api-tools / api-tools-admin

Laminas API Tools Admin module
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
13 stars 21 forks source link

Deleting API Doesn't Return APIs #46

Open michalbundyra opened 4 years ago

michalbundyra commented 4 years ago

When deleting an API, the API gets deleted, and the page then goes to a blank APIs page without the other APIs. It clears the API list but fails to fetch the new API list. The following error is returned from GET after a successful DELETE.

Fatal error:  Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (test) could not be initialized.' in /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:189
Stack trace:
#0 /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(163): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php(90): Zend\ModuleManager\ModuleManager->loadModule('test')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframewo in /media/psf/Home/phpstormprojects/api/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php on line 189

Originally posted by @forrestmid at https://github.com/zfcampus/zf-apigility-admin/issues/222

michalbundyra commented 4 years ago

This error looks to me like the config/application.config.php file is not being updated properly -- or, rather, that write operations are being reported as successful when they have not yet completed.

Short term solution: manually remove the "test" module entry from that file, if it's still there.

Long term: Is it at all possible you're running on a Mac with an SSD, by any chance? If so, we observed some problems with that combination whereby the SSD takes > 1s to commit file changes, which can lead to the situation you're seeing. As a result of these observations, we made some changes in the admin UI to add delays between receiving a success confirmation and sending off the request to retrieve the list of modules. You can try this out by running php composer.phar update in the project root; look to make sure you get at least version 1.0.3 of zf-apigility-admin.

Please let me know what you observe.


Originally posted by @weierophinney at https://github.com/zfcampus/zf-apigility-admin/issues/222#issuecomment-52491690

michalbundyra commented 4 years ago

I get same error on 1.0.4. I have ubuntu with SSD. Disable opcache in php.ini resolved issue. I think cacheEnabledAction in zf-apigility-admin should chect this, but now it's disabled.


Originally posted by @snapshotpl at https://github.com/zfcampus/zf-apigility-admin/issues/222#issuecomment-66439048