matomo-org / plugin-GoogleAnalyticsImporter

Google Analytics to Matomo importer
24 stars 14 forks source link

Importer failing - claiming site does not exist #453

Open edoswald opened 1 year ago

edoswald commented 1 year ago

I cannot get the importer working, looking at logs this is what I keep getting for every site I try to import (same error, different site number)

ERROR [2023-09-12 23:58:03] 86422 Uncaught exception: /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/plugins/GoogleAnalyticsImporter/Commands/ImportGA4Reports.php(331): Site ID 4 does not exist. [Query: , CLI mode: 1]

[Exception]
Site ID 4 does not exist.

Exception trace: () at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/plugins/GoogleAnalyticsImporter/Commands/ImportGA4Reports.php:331 Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->getIdSite() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/plugins/GoogleAnalyticsImporter/Commands/ImportGA4Reports.php:81 Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->executeImpl() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/plugins/GoogleAnalyticsImporter/Commands/ImportGA4Reports.php:57 Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->execute() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/core/Console.php:108 Piwik\Console->originDoRun() at n/a:n/a call_user_func() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/core/Console.php:147 Piwik\Console->Piwik{closure}() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/core/Access.php:670 Piwik\Access::doAsSuperUser() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/core/Console.php:148 Piwik\Console->doRunImpl() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/core/Console.php:87 Piwik\Console->doRun() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /var/www/vhosts/missioncontrol.ozmediaservices.com/httpdocs/matomo/console:32

googleanalyticsimporter:import-ga4-reports [--property="..."] [--dates="..."] [--idsite="..."] [--cvar-count="..."] [--skip-archiving] [--mobile-app] [--timezone="..."] [--extra-custom-dimension="..."]

AltamashShaikh commented 1 year ago

@edoswald How are you trying to import the data? are you trying to pass --idsite=4 in the command ? If you are trying to import via command, can you paste the command here ?

edoswald commented 1 year ago

@AltamashShaikh Via the web interface.

AltamashShaikh commented 1 year ago

@edoswald That's strange!, do you have idSite:4 created and do you have access to console of your Matomo instance ? Also have you set instance_id in config.ini.php ?

edoswald commented 1 year ago

@AltamashShaikh I don't see an instance_id, and yes, it's a self hosted install. The site ids seem to match with the ones created by the import.

snake14 commented 1 year ago

@edoswald What version of Matomo and the plugin do you have installed? PHP version? Do you see a row in your site table with the same idSite as the error message?

edoswald commented 1 year ago

@snake14 sorry this should have all been in the report, my bad. Sites exist (see phpmyadmin screenshot)

From System Summary

Matomo version: 4.15.1 MySQL version: 10.6.12-MariaDB-0ubuntu0.22.04.1 PHP version: 8.2.10 Screenshot 2023-09-13 at 7 16 16 PM

snake14 commented 1 year ago

Thank you @edoswald. It's really odd that the site gets created, but it fails to look it up during the import process. I'm guessing that you're running the latest version of the GA Importer plugin (4.6.11)?

edoswald commented 1 year ago

@snake14 yessir.. weird thing is i was able to import without a problem on my last server, this one fails every time.

snake14 commented 1 year ago

@edoswald What if you log out of Matomo and log back in? As far as I can tell, the only reason that it would fail to load the site is if it doesn't exist or if there's a permission issue.

AltamashShaikh commented 1 year ago

@edoswald Can you check if you have an entry in option table ?

SELECT * FROM `matomo_option` where option_name='GoogleAnalyticsImporter.importStatus_4'

If yes, can you run this command from /your/path/to/matomo ./console googleanalyticsimporter:import-ga4-report --idsite=4

edoswald commented 1 year ago

image

Getting the same error

image

edoswald commented 1 year ago

@snake14 would an ls -l command from a certain directory in the install help?

Here is everything from the option_value field

{"status":"started","idSite":4,"ga":{"import_type":"GA4","property":"properties\/373493187","account":"accounts\/266715688","view":""},"last_date_imported":null,"main_import_progress":null,"import_start_time":1694563083,"import_end_time":null,"last_job_start_time":1694563083,"last_day_archived":null,"import_range_start":"","import_range_end":"2023-09-11","extra_custom_dimensions":[],"days_finished_since_rate_limit":0,"reimport_ranges":[],"isGA4":true,"is_verbose_logging_enabled":true}

Server data

CPU AMD EPYC-Milan Processor (2 core(s))
Version Plesk Obsidian v18.0.53_build1800230619.12 os_Ubuntu 22.04
OS Ubuntu 22.04.3 LTS
AltamashShaikh commented 1 year ago

@edoswald Does running below command creates a new site and works as expected ?

./console googleanalyticsimporter:import-ga4-report  --property="properties/373493187" --dates="2023-09-14,2023-09-11"
edoswald commented 1 year ago

This is another error i've seen, which makes no sense. I've installed any recommended packages per installation. This might be the issue!

image

AltamashShaikh commented 1 year ago

@edoswald looks like its the issue with your cli I recommend checking with your hosting provider or try checking installed modules by running php -m command.

Closing the issue for now, feel free to open a issue if you face any other issues

edoswald commented 1 year ago

@AltamashShaikh real quick, what modules should i ensure are activated?

snake14 commented 1 year ago

Hi @edoswald. The System Check gives a pretty good list of modules to check. When you're in the Matomo app, go to the gear icon (Administration) > Diagnostic > System Check: image

edoswald commented 1 year ago

The only thing I am seeing that is an issue is this?

On Thu, Sep 14, 2023 at 4:52 PM Jacob R @.***> wrote:

Hi @edoswald https://github.com/edoswald. The System Check gives a pretty good list of modules to check. When you're in the Matomo app, go to the gear icon (Administration) > Diagnostic > System Check: [image: image] https://user-images.githubusercontent.com/11394099/268107314-19c3107c-a9e4-4c0a-8e41-7ecff3974cef.png

— Reply to this email directly, view it on GitHub https://github.com/matomo-org/plugin-GoogleAnalyticsImporter/issues/453#issuecomment-1720136809, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4QGUNSB4D7QEGSIE7KP3BTX2NU7XANCNFSM6AAAAAA4VSOGMQ . You are receiving this because you were mentioned.Message ID: @.*** com>

AltamashShaikh commented 1 year ago

@edoswald We didn't get you on your last response

edoswald commented 1 year ago

Sorry, did by email. Anyway, reinstalled everything from scratch. Appears to be some issue with the Plesk one-click, at least on a Vultr server. Installed Plesk using their web install interface on a LAMP one-click, and the only issue i had after some additional fixes which were obvious from system check is the LOCAL DATA INFILE (although the other is working, so i will leave it for now as I am only seeing a max of maybe 25k a month across all the sites tracked).

Just putting this in here in case it happens to somebody else who may have been trying to install Matomo on a Plesk one-click.

tsteur commented 11 months ago

Reopening as this issue still exists and is still happening. Some information below. The command googleanalyticsimporter:import-ga4-reports --idsite=12 was executed there.

This fatal error happened on 5.0.0-rc9

Error: {"message":"Site ID 12 does not exist.","file":"\/plugins\/GoogleAnalyticsImporter\/Commands\/ImportGA4Reports.php","line":282,"backtrace":" on \/plugins\/GoogleAnalyticsImporter\/Commands\/ImportGA4Reports.php(282)\n#0 \/plugins\/GoogleAnalyticsImporter\/Commands\/ImportGA4Reports.php(76): Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->getIdSite()\n#1 \/plugins\/GoogleAnalyticsImporter\/Commands\/ImportGA4Reports.php(53): Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->executeImpl()\n#2 \/core\/Plugin\/ConsoleCommand.php(110): Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports->doExecute()\n#3 \/vendor\/symfony\/console\/Command\/Command.php(298): Piwik\Plugin\ConsoleCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#4 \/core\/Plugin\/ConsoleCommand.php(125): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#5 \/vendor\/symfony\/console\/Application.php(1040): Piwik\Plugin\ConsoleCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#6 \/vendor\/symfony\/console\/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\GoogleAnalyticsImporter\Commands\ImportGA4Reports), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#7 \/core\/Console.php(106): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#8 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#9 \/core\/Console.php(145): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#10 \/core\/Access.php(670): Piwik\Console->Piwik\{closure}()\n#11 \/core\/Console.php(146): Piwik\Access::doAsSuperUser(Object(Closure))\n#12 \/core\/Console.php(85): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#13 \/vendor\/symfony\/console\/Application.php(171): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#14 \/console(32): Symfony\Component\Console\Application->run()\n#15 {main}","safemode_backtrace":"#0 [internal function]: Piwik\Plugins\Cloud\Controller->safemode(Array)\n#1 \/core\/FrontController.php(637): call_user_func_array(Array, Array)\n#2 \/core\/FrontController.php(169): Piwik\FrontController->doDispatch('Cloud', 'safemode', Array)\n#3 \/core\/FrontController.php(100): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#4 \/core\/FrontController.php(140): Piwik\FrontController::(Array)\n#5 \/core\/Console.php(88): Piwik\FrontController::(Object(Exception))\n#6 \/vendor\/symfony\/console\/Application.php(171): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))\n#7 \/console(32): Symfony\Component\Console\Application->run()\n#8 {main}"}

Executed on CLI

AltamashShaikh commented 11 months ago

@tsteur I tried locally and seems to working for me, can you share more details on this to reproduce the same error Screenshot from 2023-12-27 15-12-26

tsteur commented 11 months ago

@AltamashShaikh I don't have more information than this. I can reproduce this locally with a siteId that does not exist.

./console googleanalyticsimporter:import-ga4-reports --idsite=343034 ERROR [17:25:22] 94946 api.matomo.cloud Uncaught exception: Exception: Site ID 343034 does not exist. in plugins/GoogleAnalyticsImporter/Commands/ImportGA4Reports.php:282

AltamashShaikh commented 11 months ago

@tsteur Do you mean you deleted a site which had a GA import running and started getting above error post deletion ?

tsteur commented 11 months ago

Yes, or a site that never existed maybe (unsure what happened there)

AltamashShaikh commented 11 months ago

@tsteur We are deleting the import by registering to SitesManager.deleteSite.end event, may be some edge case where this event is not being fired ?

tsteur commented 10 months ago

Possible 👍