matomo
matomo copied to clipboard
Creating an Annotation produces an unexpected error
Today I saw a number of errors in the logs for our self-hosted Matomo instance where it appears that a user attempted to add an Annotation. This resulted in the Annotation being added, but Matomo threw a PHP error in the process.
Expected Behavior
Annotation should be added without throwing a PHP error.
Current Behavior
In all cases, I can see the following actions in the server logs:
- HTTP POST to /index.php?date=2022-07-10&module=Annotations&action=addAnnotation&idSite=1&managerDate=2022-07-10&managerPeriod=range¬e=Sample+annotation+(4pm)&period=range
- [Tue Jul 12 12:12:32.292376 2022] [php:notice] [pid 28552] [client 0.0.0.0:24895] Error in Matomo: The date '2022-06-27' is not a correct date range. It should have the following format: 'lastN', 'previousN', 'YYYY-MM-DD,YYYY-MM-DD'., referer: https://analytics.examplesite.org.uk/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday
Possible Solution
This looks like a parsing issue in the date range; however, it's not clear from the data shown here where the "last" and "previous" content is coming from.
Steps to Reproduce (for Bugs)
I was unable to reproduce this on your demo as annotations work fine in all of my testing, but still produce this odd error
Context
This doesn't seem to break anything, just causes an alert in our monitoring
Your Environment
- Matomo Version: 4.8.0 (Docker)
- PHP Version: 8.0.17
- Server Operating System: Linux
- Additionally installed plugins: ** API, Actions, Annotations, BulkTracking, Contents, CoreAdminHome, CoreConsole, CoreHome, CorePluginsAdmin, CoreUpdater, CoreVisualizations, CoreVue, CustomDimensions, CustomJsTracker, CustomReports 4.0.12, Dashboard, DevicePlugins, DevicesDetection, Diagnostics, Ecommerce, Events, Feedback, FormAnalytics 4.0.8, Funnels 4.0.10, GeoIp2, Goals, Heartbeat, ImageGraph, Insights, Installation, Intl, IntranetMeasurable, LanguagesManager, Live, Login, Marketplace, MobileMessaging, Monolog, Morpheus, MultiSites, Overlay, PagePerformance, PrivacyManager, ProfessionalServices, Proxy, Referrers, Resolution, RssWidget, SEO, ScheduledReports, SegmentEditor, SitesManager, Tour, Transitions, TwoFactorAuth, UserCountry, UserCountryMap, UserId, UserLanguage, UsersFlow 4.0.4, UsersManager, VisitFrequency, VisitTime, VisitorInterest, VisitsSummary, WebsiteMeasurable, Widgetize
Hi @JustinFinkelsteinKainos thank you for reporting this, I can reproduce it by changing the date selector to date range and making the start date and end date the same date, then creating an Annotation, it will show that error. Our product team will review this.
Hi Peter
Thanks for verifying this; hopefully this is a relatively fix.