Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 after remove Nextcloud user used in Cospend | "userid is not a valid attribute" #325

Open
oopen opened this issue Dec 28, 2024 · 3 comments

Comments

@oopen
Copy link

oopen commented Dec 28, 2024

Error 500 GET cospend/api/v1/projects after remove Nextcloud user used in Cospend

Cospend app doesn't work at all, after removing a nexcloud user used in one cospend project.
All project are unusable, with Copspend UI and MoneyBuster.

Nextcloud Hub 9 (30.0.4)
Cospend 3.0.8

API Request

GET /ocs/v2.php/apps/cospend/api/v1/projects HTTP/2

API Response status

HTTP/2 500

API Response body

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>failure</status>
  <statuscode>500</statuscode>
  <message>Internal Server Error
</message>
 </meta>
 <data/>
</ocs>

Nextcloud log

"Exception": "BadFunctionCallException"
"Message": "userid is not a valid attribute"
{
  "reqId": "xxxxyyyzzz",
  "level": 3,
  "time": "2024-12-28T12:35:09+00:00",
  "remoteAddr": "MYIP",
  "user": "MYUSERNAME",
  "app": "no app in context",
  "method": "GET",
  "url": "/ocs/v2.php/apps/cospend/api/v1/projects",
  "message": "userid is not a valid attribute",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
  "version": "30.0.4.1",
  "exception": {
    "Exception": "BadFunctionCallException",
    "Message": "userid is not a valid attribute",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/Entity.php",
        "line": 56,
        "function": "setter",
        "class": "OCP\\AppFramework\\Db\\Entity",
        "type": "->",
        "args": [
          "userid",
          [
            null
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 299,
        "function": "fromRow",
        "class": "OCP\\AppFramework\\Db\\Entity",
        "type": "::",
        "args": [
          {
            "id": "MYPROJECTNAME",
            "name": "MYPROJECTNAME",
            "archived_ts": null,
            "user_id": "MYUSERNAME",
            "currency_name": null,
            "0": "And 13 more entries, set log level to debug to see all entries"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 317,
        "function": "mapRowToEntity",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          {
            "id": "MYPROJECTNAME",
            "name": "MYPROJECTNAME",
            "archived_ts": null,
            "user_id": "MYUSERNAME",
            "currency_name": null,
            "0": "And 13 more entries, set log level to debug to see all entries"
          }
        ]
      },
      {
        "file": "/var/www/html/apps/cospend/lib/Db/ProjectMapper.php",
        "line": 148,
        "function": "findEntities",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\DB\\QueryBuilder\\QueryBuilder"
          }
        ]
      },
      {
        "file": "/var/www/html/apps/cospend/lib/Service/LocalProjectService.php",
        "line": 1637,
        "function": "getProjects",
        "class": "OCA\\Cospend\\Db\\ProjectMapper",
        "type": "->",
        "args": [
          "MYUSERNAME"
        ]
      },
      {
        "file": "/var/www/html/apps/cospend/lib/Service/LocalProjectService.php",
        "line": 1772,
        "function": "getProjectNames",
        "class": "OCA\\Cospend\\Service\\LocalProjectService",
        "type": "->",
        "args": [
          "MYUSERNAME"
        ]
      },
      {
        "file": "/var/www/html/apps/cospend/lib/Controller/ApiController.php",
        "line": 155,
        "function": "getLocalProjects",
        "class": "OCA\\Cospend\\Service\\LocalProjectService",
        "type": "->",
        "args": [
          "MYUSERNAME"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 208,
        "function": "getLocalProjects",
        "class": "OCA\\Cospend\\Controller\\ApiController",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 114,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Cospend\\Controller\\ApiController",
            "projectService": {
              "__class__": "OCA\\Cospend\\Service\\LocalProjectService",
              "defaultCategories": [
                {
                  "name": "Courses",
                  "icon": "🛒",
                  "color": "#ffaa00"
                },
                {
                  "name": "Bar/Fête",
                  "icon": "🎉",
                  "color": "#aa55ff"
                },
                {
                  "name": "Loyer",
                  "icon": "🏠",
                  "color": "#da8733"
                },
                {
                  "name": "Facture",
                  "icon": "🌩",
                  "color": "#4aa6b0"
                },
                {
                  "name": "Excursion/Culture",
                  "icon": "🚸",
                  "color": "#0055ff"
                },
                "And 6 more entries, set log level to debug to see all entries"
              ],
              "defaultPaymentModes": [
                {
                  "name": "Carte de crédit",
                  "icon": "💳",
                  "color": "#FF7F50",
                  "old_id": "c"
                },
                {
                  "name": "Liquide",
                  "icon": "💵",
                  "color": "#556B2F",
                  "old_id": "b"
                },
                {
                  "name": "Chèque",
                  "icon": "🎫",
                  "color": "#A9A9A9",
                  "old_id": "f"
                },
                {
                  "name": "Virement",
                  "icon": "",
                  "color": "#00CED1",
                  "old_id": "t"
                },
                {
                  "name": "Service en ligne",
                  "icon": "🌎",
                  "color": "#9932CC",
                  "old_id": "o"
                }
              ]
            },
            "userId": "MYUSERNAME"
          },
          "getLocalProjects"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Cospend\\Controller\\ApiController",
            "projectService": {
              "__class__": "OCA\\Cospend\\Service\\LocalProjectService",
              "defaultCategories": [
                {
                  "name": "Courses",
                  "icon": "🛒",
                  "color": "#ffaa00"
                },
                {
                  "name": "Bar/Fête",
                  "icon": "🎉",
                  "color": "#aa55ff"
                },
                {
                  "name": "Loyer",
                  "icon": "🏠",
                  "color": "#da8733"
                },
                {
                  "name": "Facture",
                  "icon": "🌩",
                  "color": "#4aa6b0"
                },
                {
                  "name": "Excursion/Culture",
                  "icon": "🚸",
                  "color": "#0055ff"
                },
                "And 6 more entries, set log level to debug to see all entries"
              ],
              "defaultPaymentModes": [
                {
                  "name": "Carte de crédit",
                  "icon": "💳",
                  "color": "#FF7F50",
                  "old_id": "c"
                },
                {
                  "name": "Liquide",
                  "icon": "💵",
                  "color": "#556B2F",
                  "old_id": "b"
                },
                {
                  "name": "Chèque",
                  "icon": "🎫",
                  "color": "#A9A9A9",
                  "old_id": "f"
                },
                {
                  "name": "Virement",
                  "icon": "",
                  "color": "#00CED1",
                  "old_id": "t"
                },
                {
                  "name": "Service en ligne",
                  "icon": "🌎",
                  "color": "#9932CC",
                  "old_id": "o"
                }
              ]
            },
            "userId": "MYUSERNAME"
          },
          "getLocalProjects"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Cospend\\Controller\\ApiController",
          "getLocalProjects",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "apiVersion": "v1",
            "_route": "ocs.cospend.api.getlocalprojects"
          }
        ]
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 43,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/cospend/api/v1/projects"
        ]
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 7,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/public/AppFramework/Db/Entity.php",
    "Line": 119,
    "message": "userid is not a valid attribute",
    "exception": {},
    "CustomMessage": "userid is not a valid attribute"
  }
}
@julien-nc
Copy link
Owner

Can you provide the result of this SQL query?

SELECT * FROM oc_cospend_projects;

I would like to know if there is still a userid column in the oc_cospend_projects table. It should not be there anymore.

@oopen
Copy link
Author

oopen commented Dec 28, 2024

Yes it still present, after normal application update.

Fields present are :

INSERT INTO nextcloud.oc_cospend_projects (id,name,archived_ts,user_id,currency_name,deletion_disabled,category_sort,payment_mode_sort,auto_export,last_changed,userid,email,autoexport,lastchanged,currencyname,deletiondisabled,categorysort,paymentmodesort)

And the app was bugged, with there fields.

I was force to remove the app, tables, files, and reinstall the app, because it was on production..

Now table is :

CREATE TABLE `oc_cospend_projects` (
  `id` varchar(64) NOT NULL,
  `name` varchar(300) NOT NULL,
  `archived_ts` bigint(20) unsigned DEFAULT NULL,
  `user_id` varchar(64) DEFAULT NULL,
  `currency_name` varchar(64) DEFAULT NULL,
  `deletion_disabled` int(11) NOT NULL DEFAULT 0,
  `category_sort` varchar(1) NOT NULL DEFAULT 'a',
  `payment_mode_sort` varchar(1) NOT NULL DEFAULT 'a',
  `auto_export` varchar(1) NOT NULL DEFAULT 'n',
  `last_changed` bigint(20) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

I suspect the migration don't work

@kennyMC
Copy link

kennyMC commented Dec 31, 2024

same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants