Error calculating daily stats
The calculation of the daily stats which i assume is an automatic process gives these errors:
[ Server!] at getTotalPageViews (/home/sven/SaaS//app/src/analytics/providers/plausibleAnalyticsUtils.ts:49:11)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at getDailyPageViews (/home/sven/SaaS//app/src/analytics/providers/plausibleAnalyticsUtils.ts:28:22)
[ Server!] at calculateDailyStats (/home/sven/SaaS/t/app/src/analytics/stats.ts:56:55)
[ Server!] at async resolveWithinSeconds (/home/sven/SaaS//app/node_modules/pg-boss/src/manager.js:34:14)
[ Server!] at async /home/sven/SaaS//app/node_modules/p-map/index.js:57:22
[ Server!] Error calculating daily stats: Error: HTTP error! Status: 401
[ Server!] at getTotalPageViews (/home/sven/SaaS/=ot/app/src/analytics/providers/plausibleAnalyticsUtils.ts:49:11)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at getDailyPageViews (/home/sven/SaaS//app/src/analytics/providers/plausibleAnalyticsUtils.ts:28:22)
[ Server!] at calculateDailyStats (/home/sven/SaaS//app/src/analytics/stats.ts:56:55)
[ Server!] at async resolveWithinSeconds (/home/sven/SaaS/B/app/node_modules/pg-boss/src/manager.js:34:14)
[ Server!] at async /home/sven/SaaS//app/node_modules/p-map/index.js:57:22
[ Server!] Error calculating daily stats: Error: HTTP error! Status: 401
[ Server!] at getTotalPageViews (/home/sven/SaaS/ot/app/src/analytics/providers/plausibleAnalyticsUtils.ts:49:11)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at getDailyPageViews (/home/sven/SaaS/ot/app/src/analytics/providers/plausibleAnalyticsUtils.ts:28:22)
[ Server!] at calculateDailyStats (/home/sven/SaaS/B/app/src/analytics/stats.ts:56:55)
[ Server!] at async resolveWithinSeconds (/home/sven/SaaS/t/app/node_modules/pg-boss/src/manager.js:34:14)
7 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error logs you've provided, it seems like the
getTotalPageViews
function in your plausibleAnalyticsUtils.ts
file is throwing an HTTP error with a status of 401. This status code typically indicates an authentication error, meaning the request lacks valid authentication credentials for the target resource.
In a similar issue discussed in the Wasp community here (https://discord.com/channels/686873244791210014/1215945587841831033), a user was advised to check their logs and debug the calculateDailyStats
function. They were also advised to ensure that the PLAUSIBLE_SITE_ID
is correctly set, as Plausible needs it to reach the site.
In your case, you might want to check if you have correctly set up your authentication credentials for Plausible. Make sure that the API key or any other authentication token you are using is correct. If you recently set up your domain, it might take a while for the DNS servers that Plausible is hitting to propagate.
If you continue to face issues, I would recommend reaching out to the Wasp community or opening a Github issue for more specific help.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai maybe because i havent setup google analytics or anything fo it
Let me check the knowledge base for you. One moment! :books:
----------------------
Yes, that could be the issue. The error you're seeing is related to the
getTotalPageViews
function in the plausibleAnalyticsUtils.ts
file, which is part of the Plausible analytics setup. If you haven't set up Plausible or Google Analytics, the function might fail due to missing necessary data or configuration.
In the Wasp community discussion (https://discord.com/channels/686873244791210014/1215945587841831033), it was mentioned that you need to use either Plausible or Google Analytics. If you decide to use Google Analytics, you'll need to set it up correctly and ensure that the necessary configuration is in place.
If you decide to use Plausible, make sure you have set up the PLAUSIBLE_SITE_ID
correctly. If you recently set up your domain, it might take a while for the DNS servers that Plausible is hitting to propagate.
If you continue to face issues, I would recommend reaching out to the Wasp community or opening a Github issue for more specific help.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Hey @Sven, I'm guessing that's it, yes.
Check this page for setting it up: https://docs.opensaas.sh/guides/analytics/
OpenSaaS.sh
Analytics
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
Nice thx
If you don't want to use analytics, you can remove this job here: https://github.com/wasp-lang/open-saas/blob/71d7637ac57d80685da53ab8a2f1fc842302af3e/template/app/main.wasp#L245
It's the one that's causing the errors.