kimai / kimai

Kimai is a web-based multi-user time-tracking application. Works great for everyone: freelancers, companies, organizations - everyone can track their times, generate reports, create invoices and do so much more. SaaS version available at https://www.kimai.cloud
https://www.kimai.org
GNU Affero General Public License v3.0
3.32k stars 590 forks source link

Web rendering issue after trying to export time sheets from Kimai #2161

Closed JPE49 closed 3 years ago

JPE49 commented 3 years ago

Describe the bug

Hello, I've installed Kimai2 since & month and it worked like a charm on a CentOS-7 VM, until I tried to export some data yesterday, using the integrated export function: the exported file only contained the first line, no data inside. But what bathers me most is that after I did the export, my kimai webpage looked (and still look) like this:

image

but I can still log in:

image

Somehow the rendering is buggy, and it's the case for every users, not only myself. I tried to clear the cache, I checked the permission, everything looks ok.

Please note that I have some basic knowledge about Linux and web dev, I'm no expert at all...

I tried to clear the cache but then ran into the 500 error which I fixed by re-applying the correct file permission into the /var folder of kimai. I even completely deleted the /var/cache folder at some point to make sure it was not related, but it didn't changed anything.

I restarted many times Apache, mysql and also the machine, without any effect.

To Reproduce

  1. Go to 'My times view'
  2. Click on the "export to CSV, or Excel or Pdf" (I did try the 3 of them but can't remember which one really caused the trouble
  3. Then the web page rendering was buggy

Logfile

[2020-12-03 17:02:20] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET /api/ttimesheets/356/stop": Method Not Allowed (Allow: PATCH)" at /var/www/kimai2/vendor/symfony/http-kernel/EventListener/RouterListener.php line 140 {"exception":"[obbject] (Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException(code: 0): No route found for \"GET /api/timesheets/356/stop\": Method Not Allowedd (Allow: PATCH) at /var/www/kimai2/vendor/symfony/http-kernel/EventListener/RouterListener.php:140, Symfony\\Component\\Routing\\Exception\\MethodNotAllowedExcepption(code: 0):  at /var/www/kimai2/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:42)"} []                                                     [2020-12-03 17:02:20] php.INFO: User Deprecated: The "fos_rest.exception_listener" service is deprecated since FOSRestBundle 2.8. {"exception":"[object] (ErrorExxception(code: 0): User Deprecated: The \"fos_rest.exception_listener\" service is deprecated since FOSRestBundle 2.8. at /var/www/kimai2/var/cache/prod/ContainerrNDSOVxq/getFosRest_ExceptionListenerService.php:9)"} []                                                                                                           [2020-12-03 17:02:20] php.INFO: User Deprecated: The FOS\RestBundle\EventListener\ExceptionListener class is deprecated since FOSRestBundle 2.8. {"exception":"[oobject] (ErrorException(code: 0): User Deprecated: The FOS\\RestBundle\\EventListener\\ExceptionListener class is deprecated since FOSRestBundle 2.8. at /var/www//kimai2/vendor/friendsofsymfony/rest-bundle/EventListener/ExceptionListener.php:14)"} []
[2020-12-03 17:02:20] php.INFO: User Deprecated: The "fos_rest.exception.controller" service is deprecated since FOSRestBundle 2.8. {"exception":"[object] (ErrorrException(code: 0): User Deprecated: The \"fos_rest.exception.controller\" service is deprecated since FOSRestBundle 2.8. at /var/www/kimai2/var/cache/prod/ContaainerNDSOVxq/getFosRest_Exception_ControllerService.php:9)"} []
[2020-12-03 17:02:20] php.INFO: User Deprecated: The FOS\RestBundle\Controller\ExceptionController class is deprecated since FOSRestBundle 2.8. {"exception":"[obbject] (ErrorException(code: 0): User Deprecated: The FOS\\RestBundle\\Controller\\ExceptionController class is deprecated since FOSRestBundle 2.8. at /var/www/kiimai2/vendor/friendsofsymfony/rest-bundle/Controller/ExceptionController.php:14)"} []
[2020-12-03 17:02:20] php.INFO: User Deprecated: The "fos_rest.serializer.exception_normalizer.jms" service is deprecated since FOSRestBundle 2.8. {"exception":""[object] (ErrorException(code: 0): User Deprecated: The \"fos_rest.serializer.exception_normalizer.jms\" service is deprecated since FOSRestBundle 2.8. at /var/wwww/kimai2/var/cache/prod/ContainerNDSOVxq/getFosRest_Serializer_ExceptionNormalizer_JmsService.php:9)"} []
[2020-12-03 17:02:20] php.INFO: User Deprecated: The FOS\RestBundle\Serializer\Normalizer\ExceptionHandler class is deprecated since FOSRestBundle 2.8. {"exceptiion":"[object] (ErrorException(code: 0): User Deprecated: The FOS\\RestBundle\\Serializer\\Normalizer\\ExceptionHandler class is deprecated since FOSRestBundle 2..8. at /var/www/kimai2/vendor/friendsofsymfony/rest-bundle/Serializer/Normalizer/ExceptionHandler.php:14)"} []
[2020-12-03 17:02:32] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET /api/ttimesheets/356/stop": Method Not Allowed (Allow: PATCH)" at /var/www/kimai2/vendor/symfony/http-kernel/EventListener/RouterListener.php line 140 {"exception":"[obbject] (Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException(code: 0): No route found for \"GET /api/timesheets/356/stop\": Method Not Allowedd (Allow: PATCH) at /var/www/kimai2/vendor/symfony/http-kernel/EventListener/RouterListener.php:140, Symfony\\Component\\Routing\\Exception\\MethodNotAllowedExcepption(code: 0):  at /var/www/kimai2/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:42)"} []
[2020-12-03 17:02:32] php.INFO: User Deprecated: The "fos_rest.exception_listener" service is deprecated since FOSRestBundle 2.8. {"exception":"[object] (ErrorExxception(code: 0): User Deprecated: The \"fos_rest.exception_listener\" service is deprecated since FOSRestBundle 2.8. at /var/www/kimai2/var/cache/prod/ContainerrNDSOVxq/getFosRest_ExceptionListenerService.php:9)"} []
[2020-12-03 17:02:32] php.INFO: User Deprecated: The FOS\RestBundle\EventListener\ExceptionListener class is deprecated since FOSRestBundle 2.8. {"exception":"[oobject] (ErrorException(code: 0): User Deprecated: The FOS\\RestBundle\\EventListener\\ExceptionListener class is deprecated since FOSRestBundle 2.8. at /var/www//kimai2/vendor/friendsofsymfony/rest-bundle/EventListener/ExceptionListener.php:14)"} []
[2020-12-03 17:02:32] php.INFO: User Deprecated: The "fos_rest.exception.controller" service is deprecated since FOSRestBundle 2.8. {"exception":"[object] (ErrorrException(code: 0): User Deprecated: The \"fos_rest.exception.controller\" service is deprecated since FOSRestBundle 2.8. at /var/www/kimai2/var/cache/prod/ContaainerNDSOVxq/getFosRest_Exception_ControllerService.php:9)"} []
[2020-12-03 17:02:32] php.INFO: User Deprecated: The FOS\RestBundle\Controller\ExceptionController class is deprecated since FOSRestBundle 2.8. {"exception":"[obbject] (ErrorException(code: 0): User Deprecated: The FOS\\RestBundle\\Controller\\ExceptionController class is deprecated since FOSRestBundle 2.8. at /var/www/kiimai2/vendor/friendsofsymfony/rest-bundle/Controller/ExceptionController.php:14)"} []

Additional context

Thank you in advance for your support. Best Regards, Julien

kevinpapst commented 3 years ago

Styles are missing completely. I don't see how an export should be related in any way... but okay.

What does your browser network console say? There should be 404 or 500 for files in the build/ directory I assume? Click on them to see details.

JPE49 commented 3 years ago

I'm not sure if the export is really related but that was the chain of event which lead me to this problem from what I saw.

Here is what my browser says:

image

kevinpapst commented 3 years ago

And, do these files exist on the server (inside the public/build/ directory)?

Maybe the export triggered some cache action, did you recently upgrade Kimai? What does "git status" report if you execute it in the Kimai directory?

JPE49 commented 3 years ago

The content is here:

$ pwd
/var/www/kimai2/public/build
$ ls -al
total 1612
drwxr-xr-x 4 apache apache   4096 Dec  4 10:35 .
drwxr-xr-x 6 apache apache    264 Dec  4 10:47 ..
-rw-r--r-- 1 apache apache  59302 Dec  4 10:35 0.79dbdbb9.js
-rw-r--r-- 1 apache apache  98197 Dec  4 10:35 1.32489d92.js
-rw-r--r-- 1 apache apache 172334 Dec  4 10:35 2.7ab75d0a.js
-rw-r--r-- 1 apache apache 374361 Dec  4 10:35 app.0325b7e0.css
-rw-r--r-- 1 apache apache 505421 Dec  4 10:35 app.dc6c3f34.js
-rw-r--r-- 1 apache apache  15951 Dec  4 10:35 calendar.1408f57e.css
-rw-r--r-- 1 apache apache 326023 Dec  4 10:35 calendar.541a15eb.js
-rw-r--r-- 1 apache apache    125 Dec  4 10:35 chart.34d60a88.js
-rw-r--r-- 1 apache apache   2460 Dec  4 10:35 entrypoints.json
drwxr-xr-x 2 apache apache   4096 Dec  4 10:35 fonts
drwxr-xr-x 2 apache apache    204 Dec  4 10:35 images
-rw-r--r-- 1 apache apache  46156 Dec  4 10:35 invoice.13d8ef4e.css
-rw-r--r-- 1 apache apache    144 Dec  4 10:35 invoice.74279541.js
-rw-r--r-- 1 apache apache    150 Dec  4 10:35 invoice-pdf.0efd7a97.js
-rw-r--r-- 1 apache apache   1150 Dec  4 10:35 invoice-pdf.340721a4.css
-rw-r--r-- 1 apache apache   2520 Dec  4 10:35 manifest.json
-rw-r--r-- 1 apache apache   1504 Dec  4 10:35 runtime.098eaae1.js

I tried to update Kimai after having the problem but I'm already up to date.

Here is the Git status log:

Not currently on any branch.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   ../../composer.lock
        modified:   ../../config/packages/kimai.yaml
        modified:   ../../symfony.lock
        deleted:    ../../var/cache/.gitkeep

And the only changes I did in kimai.yaml are the following:

+
+framework:
+    assets:
+        base_path: "/kimai2"
+
+    session:
+        gc_maxlifetime: 36000
+        cookie_lifetime: ~
kevinpapst commented 3 years ago

Then the problem is self-made: the assets path.

kevinpapst commented 3 years ago

You should never touch kimai.yaml - read the docs, put your changes in local.yaml. Remove the abse_path from the config, rebuild cache.

JPE49 commented 3 years ago

OK I got it. Indeed I didn't read the doc fully, my apologies, I'm the first one to say RTFM... I saw that I had to change a "local.yaml" but couldn't find it (see above...) so I changed kimai.yaml and it worked during 1 month... Anyway, I was able to fix it. The export functionality works fine now also 👍 Thank you for your support and for the tool, it's very nice !

kevinpapst commented 3 years ago

Yeah and by triggering the export a cache was updated and suddenly the new base path was used (thats at least what I assume). Great that it works now, thanks for your feedback!

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.