W
Wasp2w ago
Killshot

Getting 404 error from Plausible self hosted instance.

I have tried debugging as much as i could, would appreciate any insights.
No description
9 Replies
kapa.ai
kapa.ai2w ago
Hi @Killshot. 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 information provided in the knowledge sources, it appears you're experiencing a 404 error with Plausible Analytics integration in a Wasp application. Here's what we can gather from the available information: 1. There was a bug reported where the URL for Plausible Analytics had "v1" twice, which could cause issues. As mentioned by a community member in the Discord thread: Discord Thread "found the issue u have a bug in the url : it has v1 twice" 2. The error you're seeing might be related to the getTotalPageViews function. From the logs shared in the Discord thread: "Error calculating daily stats: Error: HTTP error! Status: 404 at getTotalPageViews (/Users/noamico/dev/wasp-demo/app/src/server/workers/plausibleAnalyticsUtils.ts:46:11)" To troubleshoot this issue, you could try the following: 1. Check if you've correctly set the PLAUSIBLE_SITE_ID environment variable. 2. Verify that the URL being used to connect to your self-hosted Plausible instance is correct and doesn't have any duplication (like the "v1" issue mentioned above). 3. Ensure that your self-hosted Plausible instance is running and accessible. 4. Check the Logs in your database, as suggested by a community member: "If the calculateDailyStats job fails, it will save a log to the DB" If you're still unable to resolve the issue after these steps, you might want to share more detailed logs or your configuration in the Wasp Discord community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Killshot, 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?
Killshot
KillshotOP2w ago
am i doing this ri8?
No description
Killshot
KillshotOP2w ago
i got api key from my self hosted instance.
genyus
genyus2w ago
The cloud-hosted base URL includes the /api path, have you tried appending that to yours?
Killshot
KillshotOP2w ago
No So it will analytics.mysite.com/api ? @genyus this worked like a charm, thanks This should be there in .env.server as a comment for future reasons that someone faces same issue....
Vinny (@Wasp)
Vinny (@Wasp)2w ago
thanks @genyus... do you think it would be better if the /api path to the example env var url @Killshot ?
Killshot
KillshotOP2w ago
definitely
Vinny (@Wasp)
Vinny (@Wasp)2w ago
ah, funny it's actually already changed in the current version:
# (OPTIONAL) get your plausible api key at https://plausible.io/login or https://your-plausible-instance.com/login
PLAUSIBLE_API_KEY=gUTgtB...
# You will find your site id in the Plausible dashboard. It will look like 'opensaas.sh'
PLAUSIBLE_SITE_ID=yoursite.com
PLAUSIBLE_BASE_URL=https://plausible.io/api # if you are self-hosting plausible, change this to your plausible instance's base url
# (OPTIONAL) get your plausible api key at https://plausible.io/login or https://your-plausible-instance.com/login
PLAUSIBLE_API_KEY=gUTgtB...
# You will find your site id in the Plausible dashboard. It will look like 'opensaas.sh'
PLAUSIBLE_SITE_ID=yoursite.com
PLAUSIBLE_BASE_URL=https://plausible.io/api # if you are self-hosting plausible, change this to your plausible instance's base url
Killshot
KillshotOP2w ago
aah that's nice, i keep migrating from 0.14 so might have missed it

Did you find this page helpful?