nextcloud / twofactor_gateway

🔑 Second factor provider using an external messaging gateway (SMS, Telegram, Signal)
GNU Affero General Public License v3.0
109 stars 62 forks source link

twofactor_gateway causes error accessing admin overview #312

Open nate2014jatc opened 4 years ago

nate2014jatc commented 4 years ago

Warning, WALL OF TEXT. This is an entry from my nextcloud log;

{"reqId":"gb9cw3lbVPfGW7ezKj2k","level":3,"time":"2019-12-22T03:19:39+00:00","remoteAddr":"192.168.1.127","user":"Nate","app":"index","method":"GET","url":"\/settings\/admin\/overview","message":{"Exception":"Error","Message":"Call to undefined function GuzzleHttp\\Psr7\\get_message_body_summary()","Code":0,"Trace":[{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/RequestException.php","line":107,"function":"getResponseBodySummary","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameter replaced ***"]},{"file":"\/var\/www\/html\/3rdparty\/guzzlehttp\/guzzle\/src\/Middleware.php","line":66,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":[{"__class__":"GuzzleHttp\\Psr7\\Request"},"*** sensitive parameter replaced ***"]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":203,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":156,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameter replaced ***",[{"__class__":"GuzzleHttp\\Promise\\Promise"},{"__class__":"Closure"},null]]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/TaskQueue.php","line":47,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":246,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":223,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":267,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":225,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/promises\/src\/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/var\/www\/html\/3rdparty\/guzzlehttp\/guzzle\/src\/Client.php","line":131,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/var\/www\/html\/lib\/private\/Http\/Client\/Client.php","line":162,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["get","https:\/\/updates.nextcloud.com\/changelog_server\/?version=16.0.7",{"verify":"\/var\/Nextcloud\/data\/files_external\/rootcerts.crt","proxy":null,"headers":[],"synchronous":true}]},{"file":"\/var\/www\/html\/lib\/private\/Updater\/ChangesCheck.php","line":127,"function":"get","class":"OC\\Http\\Client\\Client","type":"->","args":["https:\/\/updates.nextcloud.com\/changelog_server\/?version=16.0.7",{"headers":[]}]},{"file":"\/var\/www\/html\/lib\/private\/Updater\/ChangesCheck.php","line":73,"function":"queryChangesServer","class":"OC\\Updater\\ChangesCheck","type":"->","args":["https:\/\/updates.nextcloud.com\/changelog_server\/?version=16.0.7",{"id":null,"__class__":"OC\\Updater\\ChangesResult"}]},{"file":"\/var\/www\/html\/apps\/updatenotification\/lib\/UpdateChecker.php","line":66,"function":"check","class":"OC\\Updater\\ChangesCheck","type":"->","args":["https:\/\/updates.nextcloud.com\/changelog_server\/?version=16.0.7","16.0.7"]},{"file":"\/var\/www\/html\/apps\/updatenotification\/lib\/Settings\/Admin.php","line":83,"function":"getUpdateState","class":"OCA\\UpdateNotification\\UpdateChecker","type":"->","args":[]},{"file":"\/var\/www\/html\/settings\/Controller\/CommonSettingsTrait.php","line":115,"function":"getForm","class":"OCA\\UpdateNotification\\Settings\\Admin","type":"->","args":[]},{"file":"\/var\/www\/html\/settings\/Controller\/AdminSettingsController.php","line":74,"function":"formatSettings","class":"OC\\Settings\\Controller\\AdminSettingsController","type":"->","args":[{"10":[{"__class__":"OC\\Settings\\Admin\\Overview"}],"11":[{"__class__":"OCA\\UpdateNotification\\Settings\\Admin"}]}]},{"file":"\/var\/www\/html\/settings\/Controller\/CommonSettingsTrait.php","line":126,"function":"getSettings","class":"OC\\Settings\\Controller\\AdminSettingsController","type":"->","args":["overview"]},{"file":"\/var\/www\/html\/settings\/Controller\/AdminSettingsController.php","line":65,"function":"getIndexResponse","class":"OC\\Settings\\Controller\\AdminSettingsController","type":"->","args":["admin","overview"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"index","class":"OC\\Settings\\Controller\\AdminSettingsController","type":"->","args":["overview"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Settings\\Controller\\AdminSettingsController"},"index"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Settings\\Controller\\AdminSettingsController"},"index"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Settings\\Controller\\AdminSettingsController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"section":"overview","_route":"settings.AdminSettings.index"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"section":"overview","_route":"settings.AdminSettings.index"}]},{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"section":"overview","_route":"settings.AdminSettings.index"}]},{"file":"\/var\/www\/html\/lib\/base.php","line":975,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/settings\/admin\/overview"]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/apps\/twofactor_gateway\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/RequestException.php","Line":127,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko\/20100101 Firefox\/71.0","version":"16.0.6.1"}
ChristophWurst commented 4 years ago

And this doesn't happen when you disable the app?

I'd say this is a conflict in the composer dependencies of server and this app. But I'll need more info to debug.

piti-diablotin commented 4 years ago

Hi, I do have the same issue with NC16. Everything seems ok with NC17 If this is a composer conflict, I do not know how to solve it ? Maybe upgrading to NC17 is the easiest way :)

Edit: Googling the guzzle issue it seems to be a loading problem of guzzle. Solutions suggest to require the autoload.php file which is already the case... back to the conflict then

SimJoSt commented 4 years ago

@ChristophWurst I am experiencing this aswell. What Information would you need to debug the issue?

Edit: I can confirm the issue doesn't arise with NC17 and v0.15.1 of the app.

ChristophWurst commented 4 years ago

Okay, looks like it's the usual suspect: Guzzle. Apparently https://packagist.org/packages/irazasyed/telegram-bot-sdk pulls in Guzzle. And so does Nextcloud. In some cases this is fine, in others this causes huge problems. We've also seen this in https://github.com/christophwurst/nextcloud_sentry.

They have to decouble the http client from the telegram SDK, otherwise this is very hard to avoid. There is an existing ticket https://github.com/irazasyed/telegram-bot-sdk/issues/61 but it's old and with no real outcome.

So, would anyone be interested in digging deeper? As in, opening a bug report upstream to ask for a HTTPlug/PSR7 migration instead of the hard dependency on Guzzle? Then we can use https://packagist.org/packages/christophwurst/nextcloud-http-client here and everything should run smooth with Nextcloud 19+ at least.

ChristophWurst commented 4 years ago

Alternatively we can migrate to another Telegram lib or build the requests ourselves. https://packagist.org/packages/telegram-bot/api is one without a guzzle dependency that I could find

nate2014jatc commented 4 years ago

Has this gained any traction? I stumbled by and noticed that the tag was still "Needs Info" despite the issue being tracked down and suggestions for fixes being made.

ChristophWurst commented 4 years ago

No, it has not