nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.86k stars 4.01k forks source link

[Bug]: No provider found for id account exception #48039

Open melroy89 opened 2 weeks ago

melroy89 commented 2 weeks ago

⚠️ This issue respects the following points: ⚠️

Bug description

I get a lot of errors in my error log when using Nextcloud 30. It seems to be related to the Contacts app.

Steps to reproduce

  1. Install NC30 & Contacts app (v6.1.0)
  2. Go to the Contacts page: /apps/contacts/All%20contacts/
  3. See my installed apps below and use the apps
  4. See logging

image

Expected behavior

No errors in error log.

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 28 to 29)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "secret.domain.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.0.14",
        "overwrite.cli.url": "https:\/\/secret.domain.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance_window_start": 1,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "timeout": 1.5
        },
        "default_language": "nl",
        "default_locale": "nl_NL",
        "default_phone_region": "NL",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": "",
        "loglevel": 3,
        "app_install_overwrite": [
            "tasks",
            "files_antivirus",
            "forms"
        ],
        "mail_sendmailmode": "smtp",
        "skeletondirectory": "",
        "defaultapp": "files",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [
            "admin"
        ],
        "simpleSignUpLink.shown": false
    }
}

List of activated Apps

Enabled:
  - activity: 3.0.0
  - admin_audit: 1.20.0
  - bruteforcesettings: 3.0.0
  - calendar: 5.0.0
  - circles: 30.0.0-dev
  - cloud_federation_api: 1.13.0
  - contacts: 6.1.0
  - contactsinteraction: 1.11.0
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - files: 2.2.0
  - files_antivirus: 5.5.7
  - files_downloadlimit: 3.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - forms: 4.2.4
  - guests: 4.0.0
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - systemtags: 1.20.0
  - tables: 0.8.0
  - tasks: 0.16.1
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - twofactor_totp: 12.0.0-dev
  - updatenotification: 1.20.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - collectives: 2.14.3 (installed 2.14.3)
  - comments: 1.20.1 (installed 1.19.0)
  - dashboard: 7.10.0 (installed 7.8.0)
  - encryption: 2.18.0
  - federation: 1.20.0 (installed 1.19.0)
  - files_external: 1.22.0
  - firstrunwizard: 3.0.0 (installed 2.18.0)
  - nextcloud_announcements: 2.0.0 (installed 1.18.0)
  - photos: 3.0.2 (installed 2.4.0)
  - support: 2.0.0 (installed 1.11.0)
  - survey_client: 2.0.0 (installed 1.17.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - user_ldap: 1.21.0
  - weather_status: 1.10.0 (installed 1.8.0)

Nextcloud Signing status

No integrity issues via CLI (above URL doesn't exist anymore in NC30)

Nextcloud Logs

{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"listTeams","class":"OC\\Core\\Controller\\TeamsApiController","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/secret.domain.com/html/ocs/v1.php","line":43,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/secret.domain.com/html/ocs/v2.php","line":7,"args":["/var/www/secret.domain.com/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","Line":65,"message":"No provider found for id account","exception":{},"CustomMessage":"No provider found for id account"}}
{"reqId":"dWARy0jMvH4odrvz7CPS","level":3,"time":"2024-09-15T16:42:13+00:00","remoteAddr":"192.168.1.194","user":"dennis","app":"no app in context","method":"GET","url":"/ocs/v2.php/teams/resources/account/sabre-vobject-72a77443-0528-4520-8871-2f3c9e6075ef","message":"No provider found for id account","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0","version":"30.0.0.14","exception":{"Exception":"RuntimeException","Message":"No provider found for id account","Code":0,"Trace":[{"file":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","line":91,"function":"getProvider","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/core/Controller/TeamsApiController.php","line":68,"function":"getTeamsForResource","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"listTeams","class":"OC\\Core\\Controller\\TeamsApiController","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/secret.domain.com/html/ocs/v1.php","line":43,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/secret.domain.com/html/ocs/v2.php","line":7,"args":["/var/www/secret.domain.com/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","Line":65,"message":"No provider found for id account","exception":{},"CustomMessage":"No provider found for id account"}}
{"reqId":"i1qlO7QapasJsVvVQ6l6","level":3,"time":"2024-09-15T16:42:13+00:00","remoteAddr":"192.168.1.194","user":"dennis","app":"no app in context","method":"GET","url":"/ocs/v2.php/teams/resources/account/sabre-vobject-72a77443-0528-4520-8871-2f3c9e6075ef","message":"No provider found for id account","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0","version":"30.0.0.14","exception":{"Exception":"RuntimeException","Message":"No provider found for id account","Code":0,"Trace":[{"file":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","line":91,"function":"getProvider","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/core/Controller/TeamsApiController.php","line":68,"function":"getTeamsForResource","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"listTeams","class":"OC\\Core\\Controller\\TeamsApiController","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/secret.domain.com/html/ocs/v1.php","line":43,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/secret.domain.com/html/ocs/v2.php","line":7,"args":["/var/www/secret.domain.com/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","Line":65,"message":"No provider found for id account","exception":{},"CustomMessage":"No provider found for id account"}}
{"reqId":"uzgzlzhV7yGwsITgnYSB","level":3,"time":"2024-09-15T16:42:13+00:00","remoteAddr":"192.168.1.194","user":"dennis","app":"no app in context","method":"GET","url":"/ocs/v2.php/teams/resources/account/sabre-vobject-72a77443-0528-4520-8871-2f3c9e6075ef","message":"No provider found for id account","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0","version":"30.0.0.14","exception":{"Exception":"RuntimeException","Message":"No provider found for id account","Code":0,"Trace":[{"file":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","line":91,"function":"getProvider","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/core/Controller/TeamsApiController.php","line":68,"function":"getTeamsForResource","class":"OC\\Teams\\TeamManager","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"listTeams","class":"OC\\Core\\Controller\\TeamsApiController","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/secret.domain.com/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/secret.domain.com/html/ocs/v1.php","line":43,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/secret.domain.com/html/ocs/v2.php","line":7,"args":["/var/www/secret.domain.com/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php","Line":65,"message":"No provider found for id account","exception":{},"CustomMessage":"No provider found for id account"}}

Additional info

{
  "reqId": "uzgzlzhV7yGwsITgnYSB",
  "level": 3,
  "time": "2024-09-15T16:42:13+00:00",
  "remoteAddr": "192.168.1.194",
  "user": "dennis",
  "app": "no app in context",
  "method": "GET",
  "url": "/ocs/v2.php/teams/resources/account/sabre-vobject-72a77443-0528-4520-8871-2f3c9e6075ef",
  "message": "No provider found for id account",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
  "version": "30.0.0.14",
  "exception": {
    "Exception": "RuntimeException",
    "Message": "No provider found for id account",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php",
        "line": 91,
        "function": "getProvider",
        "class": "OC\\Teams\\TeamManager",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/core/Controller/TeamsApiController.php",
        "line": 68,
        "function": "getTeamsForResource",
        "class": "OC\\Teams\\TeamManager",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 208,
        "function": "listTeams",
        "class": "OC\\Core\\Controller\\TeamsApiController",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 114,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/secret.domain.com/html/ocs/v1.php",
        "line": 43,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/secret.domain.com/html/ocs/v2.php",
        "line": 7,
        "args": [
          "/var/www/secret.domain.com/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/secret.domain.com/html/lib/private/Teams/TeamManager.php",
    "Line": 65,
    "message": "No provider found for id account",
    "exception": [],
    "CustomMessage": "No provider found for id account"
  },
  "id": "66e71c69d9923"
}
W11T commented 1 week ago

same here after update from 29.0.7 to 30.0

melroy89 commented 1 week ago

Anyhow it seems to throw this error message: https://github.com/nextcloud/server/blob/8a8bbd4f9fc8b68f4cc73d50599b0f087612f0b9/lib/private/Teams/TeamManager.php#L65

HELP!

adhoc-post commented 1 week ago

Same here after update from 29.0.7 to 30.0.0.

DW4y commented 1 week ago

Same problem after the Update to 30.0.0.

gelbphoenix commented 2 days ago

Wild guess but: Shouldn't this be a if-else block?

public function getProvider(string $providerId): ITeamResourceProvider {
    $providers = $this->getProviders();
    if (isset($providers[$providerId])) {
        return $providers[$providerId];
    }

    throw new \RuntimeException('No provider found for id ' . $providerId);
}

Source: TeamManager.php Lines 59-66

melroy89 commented 2 days ago

Shouldn't this be a if-else block?

That doesn't matter.. The if has a return statement, so in case the if condition is true it will return the provider by ID ($providers[$providerId]). And since it's a return it will stop executing further. So in that case the RuntimeException is never executed..

melroy89 commented 2 days ago

Update: I found how and where to trigger the problem.. So the issue can be triggered via Contact app of Nextcloud. Still unsure if it's a core issue of the server or an issue in the Contact app..

Eg. go to all your contacts overview in the Contact app: https://<domain.com>/apps/contacts/All%20contacts/ (if set in English language).

Contact app will do teams lookup toward the OCS v2 API in Nextcloud. This is what I see in the network tab of the developer tool.

Update on update: yes creating a new contact seems to use the Address book called "Contacts".. Pretty sure here is the issue.. Somebody?

At the bottom of the page -> Clicking on "Contacts settings" -> Address books -> It does show the address books called "Accounts". So not sure what is the problem..

melroy89 commented 2 days ago

I suspect the Contacts app for now, so I created the issue here: https://github.com/nextcloud/contacts/issues/4165 (although.. it can still be a server issue in NC30, I need to know back from the devs.. At this point I'm just guessing)

gelbphoenix commented 2 days ago

At the bottom of the page -> Clicking on "Contacts settings" -> Address books -> It does show the address books called "Accounts". So not sure what is the problem..

The "account" provider could seem like the system address book. (Also despite having the said address book deactivated via a OCC command.)

melroy89 commented 2 days ago

OK.. So I dived even deeper now. And I checked the oc_addressbooks table in my MariaDB DB of NC:

image

I believe account should be renamed to system?? Or the DB record is wrong.. Either way, there is a bug.