activity icon indicating copy to clipboard operation
activity copied to clipboard

Errors caused by widget after upgrading to NC28.0.1

Open l3ochan opened this issue 2 years ago • 12 comments

Steps to reproduce

1.Upgrade to NC28.0.1 2.Have the activities app installed and activated

Expected behaviour

App should work and not generate errors

Actual behaviour

Dashboard widget generates errors

Server configuration

Operating system: Debian

Web server: Apache

Database: MariaDB

PHP version: 8.1

Nextcloud version: (see Nextcloud admin page) 28.0.1

Where did you install Nextcloud from: Community archive, manual install

Signing status: Not encrypted

Nextcloud log (data/nextcloud.log) (only one of the errors generated, they are all the same, just wuth different reqID)

{
  "reqId": "f15K5qkNoxzHwPhr70cg",
  "level": 3,
  "time": "2024-01-16T14:32:24+00:00",
  "remoteAddr": "172.71.135.39",
  "user": "Leo",
  "app": "activity",
  "method": "GET",
  "url": "/ocs/v2.php/apps/dashboard/api/v2/widget-items?widgets%5B%5D=activity",
  "message": "Parameter is undefined",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0",
  "version": "28.0.1.1",
  "exception": {
    "Exception": "OCP\\RichObjectStrings\\InvalidObjectExeption",
    "Message": "Parameter is undefined",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/activity/lib/GroupHelper.php",
        "line": 75,
        "function": "validate",
        "class": "OC\\RichObjectStrings\\Validator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/Data.php",
        "line": 248,
        "function": "addActivity",
        "class": "OCA\\Activity\\GroupHelper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/Dashboard/ActivityWidget.php",
        "line": 161,
        "function": "get",
        "class": "OCA\\Activity\\Data",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardApiController.php",
        "line": 142,
        "function": "getItemsV2",
        "class": "OCA\\Activity\\Dashboard\\ActivityWidget",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "getWidgetItemsV2",
        "class": "OCA\\Dashboard\\Controller\\DashboardApiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 65,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/RichObjectStrings/Validator.php",
    "Line": 70,
    "message": "Parameter is undefined",
    "exception": {},
    "CustomMessage": "Parameter is undefined"
  }
}

l3ochan avatar Jan 16 '24 14:01 l3ochan

Hello, this seems to be not a problem with the widget but some application provides an invalid activity. The activity contains a rich subject for which no rich parameter was set.

To further debug this we need some information which activity caused this issue, so maybe you can apply this patch, set the logging level to debug and report the output?

diff --git a/lib/GroupHelper.php b/lib/GroupHelper.php
index a997ff53..02e7631a 100644
--- a/lib/GroupHelper.php
+++ b/lib/GroupHelper.php
@@ -81,6 +81,13 @@ class GroupHelper {
                                                        'exception' => $e
                                                ],
                                        );
+                                       $this->logger->debug(
+                                               'Invalid rich subject or rich parameter',
+                                               [
+                                                       'subject' => $event->getRichSubject(),
+                                                       'parameters' => $event->getRichSubjectParameters(),
+                                               ]
+                                       );
                                        $event->setRichSubject('Rich subject or a parameter for "' . $event->getRichSubject() . '" is malformed', []);
                                        $event->setParsedSubject('Rich subject or a parameter for "' . $event->getRichSubject() . '" is malformed');
                                }

susnux avatar Jan 17 '24 12:01 susnux

Hi, Thanks foy your reply, how should I apply this patch, to which file ?

l3ochan avatar Jan 17 '24 12:01 l3ochan

Please apply the patch to apps/activity/lib/GroupHelper.php

susnux avatar Jan 17 '24 12:01 susnux

I applied the patch, logs will be with you soon

l3ochan avatar Jan 17 '24 12:01 l3ochan

Here is the log entry

{
  "reqId": "qx7FS1tTAAr1MKD0ltvp",
  "level": 3,
  "time": "2024-01-17T12:39:55+00:00",
  "remoteAddr": "172.69.222.185",
  "user": "Leo",
  "app": "activity",
  "method": "GET",
  "url": "/ocs/v2.php/apps/dashboard/api/v2/widget-items?widgets%5B%5D=activity",
  "message": "Parameter is undefined",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0",
  "version": "28.0.1.1",
  "exception": {
    "Exception": "OCP\\RichObjectStrings\\InvalidObjectExeption",
    "Message": "Parameter is undefined",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/activity/lib/GroupHelper.php",
        "line": 75,
        "function": "validate",
        "class": "OC\\RichObjectStrings\\Validator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/Data.php",
        "line": 248,
        "function": "addActivity",
        "class": "OCA\\Activity\\GroupHelper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/activity/lib/Dashboard/ActivityWidget.php",
        "line": 161,
        "function": "get",
        "class": "OCA\\Activity\\Data",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardApiController.php",
        "line": 142,
        "function": "getItemsV2",
        "class": "OCA\\Activity\\Dashboard\\ActivityWidget",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "getWidgetItemsV2",
        "class": "OCA\\Dashboard\\Controller\\DashboardApiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 65,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/RichObjectStrings/Validator.php",
    "Line": 70,
    "message": "Parameter is undefined",
    "exception": [],
    "CustomMessage": "Parameter is undefined"
  },
  "id": "65a7ca9ceab7c"
}

l3ochan avatar Jan 17 '24 12:01 l3ochan

Log entry should be a debug one, not a Warning; please activate debug mode (refer to docs).

solracsf avatar Jan 22 '24 15:01 solracsf

I turned on debug mode via the /config/config.php file but no debug log entry appears.

l3ochan avatar Jan 24 '24 09:01 l3ochan

Did you turned the debug mode on or did you set loglevel to 0?

susnux avatar Jan 24 '24 14:01 susnux

I turned on the debug mode with the line in /config/config.php but loglevel was at 3. Should I set it to 0?

l3ochan avatar Jan 25 '24 11:01 l3ochan

Yes please set loglevel to 0 and retry :)

susnux avatar Jan 25 '24 15:01 susnux

ok I think I know which app makes the widget freak out. here's the log entry, I think its the deck app that has an issue here: { "reqId": "P3oThABZzd5dHKBl9uM6", "level": 0, "time": "2024-01-26T16:15:49+00:00", "remoteAddr": "141.101.68.231", "user": "Leo", "app": "activity", "method": "GET", "url": "/ocs/v2.php/apps/dashboard/api/v2/widget-items?widgets%5B%5D=activity", "message": "Invalid rich subject or rich parameter", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0", "version": "28.0.1.1", "data": { "app": "activity", "subject": "{user} has added a description to card {card} in list {stack} on board {board}", "parameters": "{\"card\":{\"type\":\"highlight\",\"id\":59,\"name\":\"Le prototype fonctionne avec de l'énergie solaire\",\"link\":\"https://cloud.nekocorp.fr/index.php/apps/deck/card/59\"},\"board\":{\"type\":\"highlight\",\"id\":7,\"name\":\"Projet SIN🌱\",\"link\":\"https://cloud.nekocorp.fr/index.php/apps/deck/#/board/7/\"},\"stack\":{\"type\":\"highlight\",\"id\":19,\"name\":\"QC/facilité d'utilisation/sécurité\"}}" }, "id": "65b3daba1489c" }

l3ochan avatar Jan 26 '24 16:01 l3ochan

So this is caused by the deck app

susnux avatar Feb 03 '24 21:02 susnux

I think but I don't remember, it's fixed though

l3ochan avatar May 22 '24 20:05 l3ochan