quickapps / cms

Modular CMS powered by CakePHP
GNU General Public License v3.0
164 stars 69 forks source link

Error 404 - Record not found in table "roles" #182

Closed nrj4all closed 6 years ago

nrj4all commented 6 years ago

Hello, I've successfully installed QACMS and would like to report an issue as follows: I'm starting the App and everything seems well. After just a couple of clicks I'm facing a 404 error: "Error
The requested address '/' was not found on this server."

In this case I tried to login.

errors.log:

2017-09-28 21:42:46 Error: [Cake\Datasource\Exception\RecordNotFoundException] Record not found in table "roles"
Request URL: /
Referer URL: http://qacms.dev/en_US/admin/login
Client IP: 10.0.0.5
Stack Trace:
#0 [ROOT]/vendor/cakephp/cakephp/src/ORM/Table.php(1225): Cake\ORM\Query->firstOrFail()
#1 [ROOT]/vendor/quickapps-plugins/user/config/bootstrap.php(97): Cake\ORM\Table->get(2, Array)
#2 [ROOT]/vendor/quickapps-plugins/cms/src/Routing/Filter/LanguageFilter.php(91): user()
#3 [ROOT]/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): CMS\Routing\Filter\LanguageFilter->beforeDispatch(Object(Cake\Event\Event))
#4 [ROOT]/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#5 [ROOT]/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#6 [ROOT]/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#7 [ROOT]/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(80): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#8 [ROOT]/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 [ROOT]/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#10 {main}

I deleted the AOP-Cache and the browser cache and it seems that - for the moment - the issue has been clarified. But after one or two clicks the same problem occurs.

So I repopulated my database regarding to: https://github.com/quickapps/cms/tree/2.0/plugins/Installer/config

A database problem due to population inadvertences can be excluded - same issue :(

What could be the reason for that problem?

I would love to hear from you.

Sincerly

botchris commented 6 years ago

I can be caused by two things:

  1. Incorrect permissions on /tmp directory. Try clearing your cache files as well (tmp/cache)

  2. And based on the error log trace I can see that QACMS is unable to retrieve the role entity from database. Are you absolutely sure that there is a role with ID=2 on your roles table?

lightbyte commented 6 years ago

Here I have the same issue:

2018-04-04 16:24:37 Error: [Cake\Datasource\Exception\RecordNotFoundException] Record not found in table "roles"
Request URL: /client/source/en_US/admin/content/manage/create
Referer URL: http://trabajos/client/source/en_US/admin/content/manage/index
Client IP: 192.168.56.1
Stack Trace:
#0 [ROOT]/vendor/cakephp/cakephp/src/ORM/Table.php(1225): Cake\ORM\Query->firstOrFail()
#1 [ROOT]/vendor/quickapps-plugins/user/config/bootstrap.php(97): Cake\ORM\Table->get(2, Array)
#2 [ROOT]/vendor/quickapps-plugins/system/config/bootstrap.php(111): user()
#3 [internal function]: Cake\Core\Plugin::{closure}(Object(Cake\Network\Request))
#4 [ROOT]/vendor/cakephp/cakephp/src/Network/Request.php(683): call_user_func_array(Object(Closure), Array)
#5 [ROOT]/vendor/cakephp/cakephp/src/Network/Request.php(653): Cake\Network\Request->_is('useradmin', Array)
#6 [ROOT]/vendor/quickapps-plugins/user/src/Auth/CachedAuthorize.php(41): Cake\Network\Request->is('userAdmin')
#7 [ROOT]/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php(504): User\Auth\CachedAuthorize->authorize(Array, Object(Cake\Network\Request))
#8 [ROOT]/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php(309): Cake\Controller\Component\AuthComponent->isAuthorized(Array)
#9 [ROOT]/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php(260): Cake\Controller\Component\AuthComponent->authCheck(Object(Cake\Event\Event))
#10 [ROOT]/vendor/cakephp/cakephp/src/Event/EventManager.php(422): Cake\Controller\Component\AuthComponent->startup(Object(Cake\Event\Event))
#11 [ROOT]/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#12 [ROOT]/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#13 [ROOT]/vendor/cakephp/cakephp/src/Controller/Controller.php(501): Cake\Controller\Controller->dispatchEvent('Controller.star...')
#14 [ROOT]/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(116): Cake\Controller\Controller->startupProcess()
#15 [ROOT]/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(95): Cake\Http\ActionDispatcher->_invoke(Object(Content\Controller\Admin\ManageController))
#16 [ROOT]/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#17 [ROOT]/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#18 {main}

I do have the role ID=2 in DB. Could it be related to this issue: https://github.com/quickapps/cms/issues/190?

botchris commented 6 years ago

I'm pretty sure that is related to query-cache: https://github.com/quickapps/cms/blob/2.0/plugins/User/config/bootstrap.php#L97

no write permissions at ROOT/tmp/cache/?

lightbyte commented 6 years ago

I've checked the /tmp folder and /tmp/cache. In fact, I have removed all files in /tmp, refreshed browser and loaded correctly creating some files in /tmp but at the next click in browser again same error. Permissions in /tmp folder and files inside are 775. It must be another thing...

botchris commented 6 years ago

I think I found the cause: https://github.com/cakephp/cakephp/issues/10111