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

Auto Archiving errors out with "You can't access this resource as it requires an 'view' access for the website id = 1" #11767

Closed
Victorsueca opened this issue Jun 4, 2017 · 15 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Victorsueca
Copy link

Recently updated to Piwik 3.0.4 on Windows. I have a programmed task to execute the following at regular intervals:
C:\xampp\php\php.exe "C:\xampp\htdocs\stats\console" core:archive --url=https://myurl.com/piwik/
This has been working until now, but it recently started giving the following error:

Error: Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"
error";s:7:"message";s:86:"You can't access this resource as it requires an 'view' access for the website id = 1.";}'
INFO [2017-06-04 14:53:17] Error: Empty or invalid response '' for website id 1, Time elapsed: 1.045s, skipping
ERROR [2017-06-04 14:53:17] 2 total errors during this script execution, please investigate and try and fix these errors.

Other than updating piwik, the only change I made recently was removing some files that the piwik system check said where unnecesary and should be removed to prevent errors.

Any clues on what's going on?

@mattab
Copy link
Member

mattab commented Jun 21, 2017

Hi @Victorsueca
We haven't seen this problem before. Could you send us some SSH access to your Piwik + the link to this issue at http://piwik.org/contact/ ?

@Victorsueca
Copy link
Author

Victorsueca commented Jun 23, 2017

@mattab SSH to a production server with a person I do not know sounds a bit of an overkill. I propose hanging on some IRC (or other chat of your preference) to follow your instructions on debugging this.

@mattab
Copy link
Member

mattab commented Jun 23, 2017

would it maybe help if you just temporary access to only piwik to me at matt at piwik.org ?

@Victorsueca
Copy link
Author

Sounds more reasonable, is FTP ok instead of SSH?

@mattab
Copy link
Member

mattab commented Jun 25, 2017

unfortunately ssh is needed as we need to run the command and see what happens
(FTP is less secure than SSH unless you use SFTP)

@Victorsueca
Copy link
Author

The thing is I have never used SSH before since I access all my servers physically, that's why I wanted to avoid using it, because i'd like to not use a feature that allows remote access to my server before fully understanding it. So at the moment it's easier for me to follow a set of instructions and provide the output as necessary.

@zypri
Copy link

zypri commented Jul 5, 2017

Hey. I am experiencing the same error, when I try to start archiveing with Web Cron (there is no Cron Jobs/SSH available at my shared hosting). As far as I know I did not do any updates. It was a fresh installation of Piwik 3.0.4, that run for a few weeks before i tried to activate Web Cron.

Has anyone an idea?

INFO CoreAdminHome[2017-07-05 12:50:36] [592f1] SUMMARY OF ERRORS INFO CoreAdminHome[2017-07-05 12:50:36] [592f1] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:86:"You can't access this resource as it requires an 'view' access for the website id = 1.";}' INFO CoreAdminHome[2017-07-05 12:50:36] [592f1] Error: Empty or invalid response '' for website id 1, Time elapsed: 0.858s, skipping ERROR CoreAdminHome[2017-07-05 12:50:36] [592f1] 2 total errors during this script execution, please investigate and try and fix these errors. Error: 2 total errors during this script execution, please investigate and try and fix these errors.

@matfax
Copy link

matfax commented Oct 31, 2017

Having the same issue:

  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] ---------------------------
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] INIT
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] Running Piwik 3.2.0 as Super User
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] ---------------------------
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] NOTES
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] - Reports for today will be processed at most every 150 seconds. You can change this value in Piwik UI > Settings > General Settings.
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] - Reports for the current week/month/year will be requested at most every 3600 seconds.
  • [10/31/2017 00:01:05 > 74b74f: INFO] INFO [2017-10-31 00:01:05] - Archiving was last executed without error 16 days 6 hours ago
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] - Will process 1 other websites because the last time they were archived was on a different day (in the website's timezone) , IDs: 1
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] ---------------------------
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] START
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] Starting Piwik reports archiving...
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] Day has finished for website id 1 since last run
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] Will pre-process for website id = 1, period = day, date = last18
  • [10/31/2017 00:01:06 > 74b74f: INFO] INFO [2017-10-31 00:01:06] - pre-processing all visits
  • [10/31/2017 00:01:07 > 74b74f: ERR ] ERROR [2017-10-31 00:01:07] Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last18&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:83:"You can't access this resource as it requires 'view' access for the website id = 1.";}'
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Done archiving!
  • [10/31/2017 00:01:07 > 74b74f: ERR ] ERROR [2017-10-31 00:01:07] Empty or invalid response '' for website id 1, Time elapsed: 1.490s, skipping
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] ---------------------------
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] SUMMARY
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Total visits for today across archived websites: 0
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Archived today's reports for 0 websites
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Archived week/month/year for 0 websites
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Skipped 1 websites
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] - 0 skipped because no new visit since the last script execution
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] - 0 skipped because existing daily reports are less than 150 seconds old
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] - 0 skipped because existing week/month/year periods reports are less than 3600 seconds old
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] - 1 skipped because got an error while querying reporting API
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Total API requests: 0
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] done: 0/1 0%, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 1492 ms, 2 errors.
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] Time elapsed: 1.492s
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] ---------------------------
  • [10/31/2017 00:01:07 > 74b74f: INFO] INFO [2017-10-31 00:01:07] SCHEDULED TASKS
  • [10/31/2017 00:01:08 > 74b74f: INFO] INFO [2017-10-31 00:01:08] Starting Scheduled tasks...
  • [10/31/2017 00:01:08 > 74b74f: INFO] INFO [2017-10-31 00:01:08] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.purgeOutdatedArchives...
  • [10/31/2017 00:01:08 > 74b74f: INFO] INFO [2017-10-31 00:01:08] Purging archives in 8 archive tables.
  • [10/31/2017 00:01:09 > 74b74f: INFO] INFO [2017-10-31 00:01:09] Deleted 9 rows in archive tables (numeric + blob) for 2017-10-15.
  • [10/31/2017 00:01:09 > 74b74f: INFO] INFO [2017-10-31 00:01:09] Scheduler: finished. Time elapsed: 1.290s
  • [10/31/2017 00:01:10 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: executing task Piwik\Plugins\ExamplePlugin\Tasks.myTask...
  • [10/31/2017 00:01:10 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: finished. Time elapsed: 0.000s
  • [10/31/2017 00:01:10 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: executing task Piwik\Plugins\UsersManager\Tasks.setUserDefaultReportPreference...
  • [10/31/2017 00:01:10 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: finished. Time elapsed: 0.152s
  • [10/31/2017 00:01:10 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: executing task Piwik\Plugins\CustomPiwikJs\Tasks.updateTracker...
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:10] Scheduler: finished. Time elapsed: 0.231s
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.purgeInvalidatedArchives...
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: finished. Time elapsed: 0.016s
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteReportData...
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: finished. Time elapsed: 0.071s
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteLogData...
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: finished. Time elapsed: 0.061s
  • [10/31/2017 00:01:11 > 74b74f: INFO] INFO [2017-10-31 00:01:11] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.optimizeArchiveTable...
  • [10/31/2017 00:01:19 > 74b74f: INFO] INFO [2017-10-31 00:01:19] Scheduler: finished. Time elapsed: 7.990s
  • [10/31/2017 00:01:19 > 74b74f: INFO] INFO [2017-10-31 00:01:19] Scheduler: executing task Piwik\Plugins\CoreUpdater\Tasks.sendNotificationIfUpdateAvailable...
  • [10/31/2017 00:01:19 > 74b74f: INFO] INFO [2017-10-31 00:01:19] Scheduler: finished. Time elapsed: 0.030s
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Scheduler: executing task Piwik\Plugins\Marketplace\Tasks.clearAllCacheEntries...
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Scheduler: finished. Time elapsed: 0.003s
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Scheduler: executing task Piwik\Plugins\Marketplace\Tasks.sendNotificationIfUpdatesAvailable...
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Scheduler: finished. Time elapsed: 0.496s
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] done
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] ---------------------------
  • [10/31/2017 00:01:20 > 74b74f: ERR ] ERROR [2017-10-31 00:01:20] 2 total errors during this script execution, please investigate and try and fix these errors.
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] ---------------------------
  • [10/31/2017 00:01:20 > 74b74f: INFO] INFO [2017-10-31 00:01:20] SUMMARY OF ERRORS
  • [10/31/2017 00:01:21 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last18&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:83:"You can't access this resource as it requires 'view' access for the website id = 1.";}'
  • [10/31/2017 00:01:21 > 74b74f: INFO] INFO [2017-10-31 00:01:20] Error: Empty or invalid response '' for website id 1, Time elapsed: 1.490s, skipping

@webtaurus
Copy link

I saw the same error, but I was able to login as soon as I logged in to the site for which I use the Piwik/Matomo install.

@voarsh
Copy link

voarsh commented Nov 12, 2018

I have this issue too!

I have made a user with read access to the sites, I've tried making superadmin, if I make it a super admin I get this:

Error: The method 'runCronArchiving' does not exist or is not available in the module '\Piwik\Plugins\CoreAdminHome\API'.

This is really bad, archiving can't happen.

@tsteur
Copy link
Member

tsteur commented Nov 12, 2018

Are you using the console to run archiving? If not maybe switch to ./console core:archive. It definitely needs a super user AFAIK. If the method is not there, I recommend you update to the latest Matomo and/or update the same version manually see https://matomo.org/docs/update/#the-manual-three-step-update

@voarsh
Copy link

voarsh commented Nov 12, 2018

I am already using the latest version.

I am using the web based Cron method.

I cannot use the SSH Cron because the system I am running on is using PHP 5.4 - an error about upgrading is shown. But the website itself for Matomo is using PHP + 7.

@tsteur
Copy link
Member

tsteur commented Nov 12, 2018

I am already using the latest version.

The latest Matomo version shouldn't run with PHP 5.4 AFAIK (Matomo 3.X)

@voarsh
Copy link

voarsh commented Nov 12, 2018

I don't think you're actually reading my response properly. The Cron on the system (Plesk) is running on 5.4, but the web Cron (API) is using PHP 7. Using superuser generates no permission to view site error.

@mattab
Copy link
Member

mattab commented Jun 18, 2019

Thank you for the report 👍 To likely fix the issue, could you upgrade to the latest Matomo version?
see https://matomo.org/docs/update/

if you still experience this issue afterwards, please re-open this and post a comment. Thanks!

@mattab mattab closed this as completed Jun 18, 2019
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

7 participants