Got invalid response from API request: Response was empty


#1

Banging my head here.

Using latest piwik 2.4.0 and php 5.5.1.3 on IIS8.5.
Everything works with the exception of emailed reports not being sent out. So I followed the archiving instrustions for windows to setup a scheduled task. A trivial thing to do. Went to manually run the task from a cammadnd prompt for testing and get two errors.

  1. The first talks about memory limit in php.ini blah blah. I adjusted to 512M, performed an iisreset and rerun the script. Still same error.
  2. URL is valid. Dont know whats going on here. Read something about the job using ipv6 instead of ipv4 so I put the entry in my hosts file. No change and still get same error.

One thing to note and not sure this is the cause. I am using IIS URL Rewrite 2.0 to redirect http to https. This does not seem to be a problem with using the appication but worth noting cause it is the only outside the box configuration.

Not sure where to go from here. Can someone please point me inm the right direction?

Regards,
-D

INFO CoreConsole[2014-07-09 15:18:31] [59da6] ---------------------------
INFO CoreConsole[2014-07-09 15:18:31] [59da6] INIT
INFO CoreConsole[2014-07-09 15:18:31] [59da6] Piwik is installed at: https://analytics.domain.com/index.php
INFO CoreConsole[2014-07-09 15:18:31] [59da6] Running Piwik 2.4.0 as Super User
ERROR CoreConsole[2014-07-09 15:18:32] [59da6] Got invalid response from API request: https://analytics.domain.com/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was 'Got invalid response from API request: https://analytics.domain.com/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error Log file for more details.'
ERROR CoreConsole[2014-07-09 15:18:32] [59da6] The Piwik URL https://analytics.domain.com/index.php does not seem to be pointing to a Piwik server. Response was ‘’.


(mike) #2

I know nothing about IIS, but two tests that might help debug:

  1. What happens when you pull the API requests out of the log and just put them in the browser of the server?

  2. What exact command are you using to call this script?


#3
  1. Result of pasting api request in the browser. Dont know what this signifies. Some enlightenment is needed,

a:40:{s:9:“nb_visits”;s:6:“Visits”;s:16:“nb_uniq_visitors”;s:15:“Unique visitors”;s:10:“nb_actions”;s:7:“Actions”;s:20:“nb_actions_per_visit”;s:17:“Actions per Visit”;s:16:“avg_time_on_site”;s:20:“Avg. Time on Website”;s:11:“bounce_rate”;s:11:“Bounce Rate”;s:15:“conversion_rate”;s:15:“Conversion Rate”;s:5:“label”;s:5:“Label”;s:4:“date”;s:4:“Date”;s:16:“avg_time_on_page”;s:17:“Avg. time on page”;s:14:“sum_time_spent”;s:41:“Total time spent by visitors (in seconds)”;s:16:“sum_visit_length”;s:41:“Total time spent by visitors (in seconds)”;s:12:“bounce_count”;s:7:“Bounces”;s:22:“bounce_count_returning”;s:33:“Bounce Count for Returning Visits”;s:11:“max_actions”;s:28:“Maximum actions in one visit”;s:21:“max_actions_returning”;s:38:“Maximum actions in one returning visit”;s:29:“nb_visits_converted_returning”;s:36:“Number of converted returning visits”;s:26:“sum_visit_length_returning”;s:51:“Total time spent by returning visitors (in seconds)”;s:19:“nb_visits_converted”;s:23:“Visits with Conversions”;s:14:“nb_conversions”;s:11:“Conversions”;s:7:“revenue”;s:7:“Revenue”;s:7:“nb_hits”;s:9:“Pageviews”;s:15:“entry_nb_visits”;s:9:“Entrances”;s:22:“entry_nb_uniq_visitors”;s:16:“Unique entrances”;s:14:“exit_nb_visits”;s:5:“Exits”;s:21:“exit_nb_uniq_visitors”;s:12:“Unique exits”;s:18:“entry_bounce_count”;s:7:“Bounces”;s:17:“exit_bounce_count”;s:7:“Bounces”;s:9:“exit_rate”;s:9:“Exit rate”;s:26:“sum_daily_nb_uniq_visitors”;s:27:“Unique visitors (daily sum)”;s:32:“sum_daily_entry_nb_uniq_visitors”;s:28:“Unique entrances (daily sum)”;s:31:“sum_daily_exit_nb_uniq_visitors”;s:24:“Unique exits (daily sum)”;s:16:“entry_nb_actions”;s:27:“Actions after entering here”;s:22:“entry_sum_visit_length”;s:61:“Total time spent by visitors (in seconds) after entering here”;s:9:“nb_events”;s:12:“Total events”;s:15:“sum_event_value”;s:11:“Total value”;s:15:“min_event_value”;s:13:“Minimum value”;s:15:“max_event_value”;s:13:“Maximum value”;s:15:“avg_event_value”;s:13:“Average value”;s:20:“nb_events_with_value”;s:19:“Events with a value”;}

  1. Script I am running to produce errors above.
    php.exe “C:\DATA\Websites\analytics.domain.com\console” core:archive --url=https://analytics.domain.com/

Regards,
-D


#4

I have been trying to get this to work for over a month with no luck. The reply I got from Matt was:
“This is a server misconfiguration issue. Why does it return blank? we cannot explain for you I’m afraid, mostly because we are not windows server expert (we do all our hosting on Linux based servers). In your case please contract a Windows server expert as this is not directly a Piwik issue.”

When the request is issued through a browser it works but when issued through code it fails. I do agree it is a configuration/security issue of some kind, the request is being blocked but I am disappointed on the lack of support. Once the documentation contains " • Windows: How to Set up Auto-Archiving Using Windows Scheduler" there should be some obligation to support it. Since the API’s are not standard web services, the typical tool available for tracing request (system service model trace listener) is not available.

If anyone resolves this issue, please post it here.


(Matthieu Aubry) #5

I may be lil wrong in my initial response, as this could also be a bug in Piwik. Unfortunately we do not run extensive tests on windows. Do you have a developer in house that maybe could help us troubleshoot this issue?

Here is starting point: update to Piwik 2.4.1 then run the command with the parameter -v

This will enable the verbose mode which should show the exact command executed by piwik. What is this command that returns “” ?


#6

I ran the command with the -v option and from what it appears, the issue revolves around the use of HTTPS. We have our web site set as requiring the use of SSL. when I ran the archive with the -v, it displayed “Exception’ with message 'curl_exec: SSL certificate problem: unable to get local issuer certificate”. We have a cert and it is installed on the server and has given us no problems with our site or to anyone using our site. I suspect the must be some type of setup needed to access https from php. Below is the entire output with the actual site name removed for privacy reasons.

C:\piwik>c:\php\php.exe c:\piwik\console core:archive --url=https://ccccc.sssssss.com/webanalytics/ -v
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] ---------------------------
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] INIT
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] Piwik is installed at: https://ccccc.sssssss.com/webanalytics/index.php
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] Running Piwik 2.4.1 as Super User
DEBUG CoreConsole[2014-07-11 17:53:13] [3fab2] Execute HTTP API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
exception ‘Exception’ with message ‘curl_exec: SSL certificate problem: unable to get local issuer certificate. Hostname requested was: ccccc.sssssss.com’ in C:\piwik\core\Http.php:491
Stack trace:
#0 C:\piwik\core\CliMulti.php(232): Piwik\Http::sendHttpRequestBy(‘curl’, ‘https://ccccc.s…’, 0, NULL, NULL, NULL, 0, false, false)
#1 C:\piwik\core\CliMulti.php(98): Piwik\CliMulti->executeNotAsyncHttp(‘https://ccccc.s…’, Object(Piwik\CliMulti\Output))
#2 C:\piwik\core\CliMulti.php(268): Piwik\CliMulti->start(Array)
#3 C:\piwik\core\CliMulti.php(66): Piwik\CliMulti->requestUrls(Array)
#4 C:\piwik\core\CronArchive.php(700): Piwik\CliMulti->request(Array)
#5 C:\piwik\core\CronArchive.php(1079): Piwik\CronArchive->request(’?module=API&met…’)
#6 C:\piwik\core\CronArchive.php(127): Piwik\CronArchive->checkPiwikUrlIsValid()
#7 C:\piwik\core\CronArchive.php(109): Piwik\CronArchive->init()
#8 C:\piwik\misc\cron\archive.php(47): Piwik\CronArchive->main()
#9 C:\piwik\plugins\CoreConsole\Commands\CoreArchiver.php(42): include(‘C:\piwik\misc\c…’)
#10 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(252):Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(887):Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\piwik\core\Console.php(64): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInputObject(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(124): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 C:\piwik\console(31): Symfony\Component\Console\Application->run()
#16 {main}
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] Got invalid response from API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. The response was empty
This usually means a server error. This solution to this is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error file for more details.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] Got invalid response from API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. The response was empty.This usually means a server error. This solution to this error is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error Log file for more details.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] The Piwik URL https://ccccc.sssssss.com/webanalytics/index.php does not seem to be pointing to a Piwik server. Response was ‘’.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] The Piwik URL https://ccccc.sssssss.com/webanalytics/index.php does not seem to be pointing to a Piwik server. Response was ‘’.


#7

Doesn’t look like my reply posted so I will try again:

It looks like the issue steams from using SSL. Our site is configured to require SSL on all connections so I am unable to disable it for Piwik. When I ran the archive with -v it returned “‘Exception’ with message 'curl_exec: SSL certificate problem: unable to get local issuer certificate.”. I suppressed the actual URL for privacy but the rest of the log is unaltered.

C:\piwik>c:\php\php.exe c:\piwik\console core:archive --url=https://ccccc.sssssss.com/webanalytics/ -v
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] ---------------------------
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] INIT
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] Piwik is installed at: https://ccccc.sssssss.com/webanalytics/index.php
INFO CoreConsole[2014-07-11 17:53:13] [3fab2] Running Piwik 2.4.1 as Super User
DEBUG CoreConsole[2014-07-11 17:53:13] [3fab2] Execute HTTP API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
exception ‘Exception’ with message ‘curl_exec: SSL certificate problem: unable to get local issuer certificate. Hostname requested was: ccccc.sssssss.com’ in C:\piwik\core\Http.php:491
Stack trace:
#0 C:\piwik\core\CliMulti.php(232): Piwik\Http::sendHttpRequestBy(‘curl’, ‘https://ccccc.s…’, 0, NULL, NULL, NULL, 0, false, false)
#1 C:\piwik\core\CliMulti.php(98): Piwik\CliMulti->executeNotAsyncHttp(‘https://ccccc.s…’, Object(Piwik\CliMulti\Output))
#2 C:\piwik\core\CliMulti.php(268): Piwik\CliMulti->start(Array)
#3 C:\piwik\core\CliMulti.php(66): Piwik\CliMulti->requestUrls(Array)
#4 C:\piwik\core\CronArchive.php(700): Piwik\CliMulti->request(Array)
#5 C:\piwik\core\CronArchive.php(1079): Piwik\CronArchive->request(’?module=API&met…’)
#6 C:\piwik\core\CronArchive.php(127): Piwik\CronArchive->checkPiwikUrlIsValid()
#7 C:\piwik\core\CronArchive.php(109): Piwik\CronArchive->init()
#8 C:\piwik\misc\cron\archive.php(47): Piwik\CronArchive->main()
#9 C:\piwik\plugins\CoreConsole\Commands\CoreArchiver.php(42): include(‘C:\piwik\misc\c…’)
#10 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(252):Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(887):Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\piwik\core\Console.php(64): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInputObject(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\piwik\vendor\symfony\console\Symfony\Component\Console\Application.php(124): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 C:\piwik\console(31): Symfony\Component\Console\Application->run()
#16 {main}
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] Got invalid response from API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. The response was empty
This usually means a server error. This solution to this is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error file for more details.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] Got invalid response from API request: https://ccccc.sssssss.com/webanalytics/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. The response was empty.This usually means a server error. This solution to this error is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error Log file for more details.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] The Piwik URL https://ccccc.sssssss.com/webanalytics/index.php does not seem to be pointing to a Piwik server. Response was ‘’.
ERROR CoreConsole[2014-07-11 17:53:14] [3fab2] The Piwik URL https://ccccc.sssssss.com/webanalytics/index.php does not seem to be pointing to a Piwik server. Response was ‘’.