View Could not be updated. An internal server error occurred.

Hi Michal,
Thanks for releasing 1.1. I have upgraded to it and it went smoothly.

On another note, so far, my server was hosted on the LAN. Now, I'm trying to host it online and everything went fine. I'm admin and am able to access the server online. However, other users are getting error messages. In the error below, Pawan Sharma(MIS) can access the server as an admin but as a regular user he gets following error message. Can you please help?

"Unexpected Error

An unexpected error occured while processing the request."

Event Details

Type: Errors
Severity: Error Error
Date: 15/11/2013 8:34 pm
Message: Unhandled System_Db_Exception: in /home/content/29/12122329/html/cc/system/db/mysqli/engine.inc.php on line 287
Stack trace:
#0 /home/content/29/12122329/html/cc/system/db/mysqli/engine.inc.php(110): System_Db_Mysqli_Engine->handleError(Object(mysqli))
#1 /home/content/29/12122329/html/cc/system/db/mysqli/engine.inc.php(90): System_Db_Mysqli_Engine->executeStatement('SELECT p.projec...', Array)
#2 /home/content/29/12122329/html/cc/system/db/connection.inc.php(256): System_Db_Mysqli_Engine->query('SELECT p.projec...', Array)
#3 /home/content/29/12122329/html/cc/system/db/connection.inc.php(289): System_Db_Connection->queryArgs('SELECT p.projec...', Array)
#4 /home/content/29/12122329/html/cc/system/db/connection.inc.php(277): System_Db_Connection->queryTableArgs('SELECT p.projec...', Array)
#5 /home/content/29/12122329/html/cc/system/api/projectmanager.inc.php(72): System_Db_Connection->queryTable('SELECT p.projec...', 8, 2)
#6 /home/content/29/12122329/html/cc/server/actions.inc.php(256): System_Api_ProjectManager->getProjects()
#7 [internal function]: Server_Actions->listProjects()
#8 /home/content/29/12122329/html/cc/server/application.inc.php(46): call_user_func_array(Array, Array)
#9 /home/content/29/12122329/html/cc/system/core/application.inc.php(210): Server_Application->execute()
#10 /home/content/29/12122329/html/cc/system/bootstrap.inc.php(130): System_Core_Application->run()
#11 /home/content/29/12122329/html/cc/server/webissues/handler.php(265): System_Bootstrap::run('Server_Applicat...', 'Server_WebIssue...')
#12 {main}
User name: Pawan Sharma(MIS)
Host name: 59.90.108.8

Re: View Could not be updated. An internal server error ...

I will try to investigate this. It would be nice if you could enable the debug log to get more information.

Regards,
Michał

Re: View Could not be updated. An internal server error ...

After reading instructions at http://wiki.mimec.org/wiki/WebIssues/Configuration, I tried to enable debug log by adding data/site.ini. The contents of site.ini are as pasted below.

[global]
debug_info = on

[global]
debug_level = DEBUG_ALL

However, I don't see any data/log folder. I have gone through the same scenario where I get error but the log file is not getting generated. Can you please tell me if I'm doing anything wrong?

Thanks,
Nitin

Re: View Could not be updated. An internal server error ...

You have to create the folder and make sure it's writable.

Regards,
Michał

Re: View Could not be updated. An internal server error ...

Thanks Michal!

Here is your log file https://dl.dropboxusercontent.com/u/38398395/default.log

Initially, I tried with pawan.mis as admin. Then I made him a regular user. I have also tried using id mis8 (a regular user).
In both cases, I get the error when logging is as regular user.

Thanks,
Nitin

Re: View Could not be updated. An internal server error ...

It looks like there is a problem with the effective_rights view, because it's the only difference between the query for admin and non-admin users. Could you check if the view exists in the database and if you can execute a select on it?

Regards,
Michał

Re: View Could not be updated. An internal server error ...

That's weird!! I see effective_rights on my LAN DB (and it is working fine). But, the hosted online seems to be missing this view even though I exported it from the LAN DB. In last 1 hour I've tried to back up the DB from LAN and restore it onto the hosted DB a couple of times but mysteriously effective_rights doesn't showup on the hosted DB. All other tables are there.

Here is the screenshot of my DB. https://dl.dropboxusercontent.com/u/38398395/Effective_Rights.JPG

Do you know what I might be doing wrong here?

Thanks,
Nitin

Re: View Could not be updated. An internal server error ...

Perhaps the DB export didn't contain the view. You can try to create it manually:

CREATE VIEW effective_rights AS
SELECT p.project_id, u.user_id, COALESCE( r.project_access, 1 ) AS project_access
FROM projects AS p
CROSS JOIN users AS u
LEFT OUTER JOIN rights AS r ON r.project_id = p.project_id AND r.user_id = u.user_id
WHERE r.project_access IS NOT NULL OR p.is_public = 1

Regards,
Michał

Re: View Could not be updated. An internal server error ...

Worked like a charm!!
Finally, I'm online. Thank you very much Michal. Your support is much appreciated.

Nitin

Re: View Could not be updated. An internal server error ...

Hello,

I think I have the same issue. Only admin can access the views. Regular user get "an unexpected error".

It appeared after updating to 1.1. Perhaps something went wrong during the update?

I've tried your solution, but I get this error message :

Query: CREATE VIEW effective_rights AS SELECT p.project_id, u.user_id, COALESCE( r.project_access, 1 ) AS project_access FROM projects ...

Error Code: 1050
Table 'effective_rights' already exists

Any idea?

Thanks in advance for your help,

Re: View Could not be updated. An internal server error ...

I actually found the solution.

The problem solved itself after rebooting the SQL server...

After analyzing the log, it seems that it's not related to WebIssues but with MySQL : http://dev.mysql.com/doc/refman/5.1/en/statement-repreparation.html

Have a nice day folks!