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

Archive run fails after update to the latest stable version (when using LoginHttpAuth plugin) #9087

Closed
jval opened this issue Oct 23, 2015 · 12 comments · Fixed by matomo-org/plugin-LoginHttpAuth#12
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@jval
Copy link

jval commented Oct 23, 2015

/usr/bin/php /var/www/analytics/console core:archive --url=https://www.example.org/analytics/ > /var/www/analytics/tmp/piwik-archive.log

ERROR [2015-10-23 14:51:31] Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was 'PHP Fatal error: Call to a member function getUserByTokenAuth() on a non-object in /var/www/analytics/plugins/Login/Auth.php on line 74 a:2:{s:6:"result";s:5:"error";s:7:"message";s:23:"A fatal error occurred.";}'
ERROR [2015-10-23 14:51:31] Empty or invalid response '' for website id 1, Time elapsed: 3.127s, skipping
ERROR [2015-10-23 14:51:31] 2 total errors during this script execution, please investigate and try and fix these errors.

[Exception]
2 total errors during this script execution, please investigate and try and fix these errors.

core:archive [--url="..."] [--force-all-websites] [--force-all-periods[="..."]] [--force-timeout-for-periods[="..."]] [--skip-idsites[="..."]] [--skip-all-segments] [--force-idsites[="..."]] [--force-periods[="..."]] [--force-date-last-n="..."] [--force-date-range[="..."]] [--force-idsegments="..."] [--concurrent-requests-per-website[="..."]] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate]

@pltcldvlpr
Copy link

have to confirm.

@tsteur
Copy link
Member

tsteur commented Oct 26, 2015

A fatal error occurred.

Can you check your PHP error logs to see what kinda error exactly occurred?

@dani
Copy link

dani commented Oct 28, 2015

Also have the same issue. I'm running on a CentOS 7 x86_64 box (php 5.4.16). I have the LoginHttpAuth plugin installed and enabled (not sure if it's related). Which info do you need to track this ?

@tsteur
Copy link
Member

tsteur commented Oct 28, 2015

We'd need you to check the PHP/Webserver error logs to see if you find any error message at the time the cron ran

@pltcldvlpr
Copy link

@dani LoginHttpAuth is definitively involved in this topic. Yesterday, I deactivated the plugin and now it works. Now, there is another error but I don't think that it has anything to do with this topic.

@tsteur I would be glad to help but unfortunately I cannot access the error logs.

@tsteur
Copy link
Member

tsteur commented Oct 28, 2015

@diosmosis are you maybe aware of any issues with LoginHttpAuth plugin and Archiving? Not sure how the plugin works, maybe you have an idea.

@diosmosis
Copy link
Member

No, not familiar w/ that plugin. This should've been caught by the tests. I'll look into it.

@diosmosis diosmosis self-assigned this Oct 29, 2015
@jval
Copy link
Author

jval commented Oct 29, 2015

what kinda error exactly occurred?

Call to a member function getUserByTokenAuth() on a non-object in /var/www/analytics/plugins/Login/Auth.php on line 74

That means the object passed to that function was empty. Which is a sign something went wrong before that function was called.

It sounds like there's some problem with LoginHttpAuth and the way the archive run is authenticating.

@dani
Copy link

dani commented Oct 29, 2015

I've just applied a quick'n'dirty hack to make it work:

--- plugins/LoginHttpAuth/Auth.php.orig 2015-10-29 10:46:02.853128530 +0100
+++ plugins/LoginHttpAuth/Auth.php      2015-10-28 19:03:17.993386299 +0100
@@ -51,7 +51,7 @@
      */
     public function authenticate()
     {
-        $httpLogin = $this->getHttpAuthLogin();
+        $httpLogin = (php_sapi_name() == "cli") ? 'admin' : $this->getHttpAuthLogin();
         if (!empty($httpLogin)) {
             $user = $this->userModel->getUser($httpLogin);

There are better ways to achieve this. The problem is that LoginHttpAuth doesn't support auth by token, so I just force using the admin user when running from the CLI

diosmosis pushed a commit to matomo-org/plugin-LoginHttpAuth that referenced this issue Oct 29, 2015
@diosmosis diosmosis added this to the 2.15.1 milestone Oct 29, 2015
@diosmosis diosmosis added the Bug For errors / faults / flaws / inconsistencies etc. label Oct 29, 2015
diosmosis added a commit to matomo-org/plugin-LoginHttpAuth that referenced this issue Oct 29, 2015
Fixes matomo-org/matomo#9087 use composition instead of inheritance in Auth class
@diosmosis
Copy link
Member

Just released a new LoginHttpAuth version w/ the fix (1.0.3). Please comment if it doesn't have the desired effect.

@mattab mattab changed the title Archive run fails after update to the latest stable version Archive run fails after update to the latest stable version (when using LoginHttpAuth plugin) Oct 30, 2015
@jval
Copy link
Author

jval commented Oct 30, 2015

Updated.

/usr/bin/php /var/www/analytics/console core:archive --url=https://www.example.org/analytics/ > /var/www/analytics/tmp/piwik-archive.log

No output and exit status is 0. Works. Thanks!

@dani
Copy link

dani commented Oct 30, 2015

Working for me too. Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants