pulibrary / pdc_discovery

Princeton Data Commons discovery portal for Research Data
10 stars 0 forks source link

Our plausible account seems to be disabled? #563

Closed bess closed 6 months ago

bess commented 6 months ago

Both of these errors seem to be caused by our inability to connect to plausible:

{"error":"The account that owns this API key does not have access to Stats API. Please make sure you're using the API key of a subscriber account and that the subscription plan includes Stats API"}

hectorcorrea commented 6 months ago

For reference, we had a similar issue before: https://github.com/pulibrary/pdc_discovery/issues/462

kelynch commented 6 months ago

I'm checking on the payment info now. Since we don't have access to the API, this is currently manifesting in the UI as views/downloads not appearing (though the stats are still being recorded in our account): Screenshot 2024-02-01 at 3 05 46 PM

kelynch commented 6 months ago

I confirmed that there doesn't appear to be an issue with our payment info. The issue is ongoing. As an admin for the sites, I created the original API keys and since my account is also displaying the "Your account does not have access to Stats API." warning when I log in, I've contacted Plausible customer support for guidance.

hectorcorrea commented 6 months ago

I notice that when logged in with my Princeton account it shows as "free trial" -- to be fair, I have no idea what it showed last year, but it looks odd.

Screenshot 2024-02-02 at 9 48 25 AM

kelynch commented 6 months ago

My account looks the same way, which I agree feels like something has changed for individuals but I can't say for sure.

I got a response from customer service as follows:

"Your API key does not work because your account is an expired trial. But even if you had an active subscription, your API key wouldn't work because only the owner's API key can query stats for the dashboards he owns. Can you please ask Account Owner to generate a key for you?"

I reached out to Tracy to pair on this as soon as possible.

hectorcorrea commented 6 months ago

@kelynch the new key in staging seems to be OK...making a call to Plausible does not return an error:

deploy@pdc-discovery-staging1:/opt/pdc_discovery/current$ bundle exec rails c
Loading staging environment (Rails 6.1.7.4)                                     
irb(main):001:0> Plausible.pageviews(174742)
=> 0

whereas the same call in production results in an error:

deploy@pdc-discovery-prod1:/opt/pdc_discovery/current$ bundle exec rails c
Loading production environment (Rails 6.1.7.4)
irb(main):001:0> Plausible.pageviews(174742)
PLAUSIBLE ERROR: (Pageviews for document: 174742) {"error":"The account that owns this API key does not have access to Stats API. Please make sure you're using the API key of a subscriber account and that the subscription plan includes Stats API"}
=> 0

There are no statistics at all in staging, though. But i looks like this has been the case for a very long time:

Screenshot 2024-02-05 at 4 24 10 PM

I suspect we can safely update production with the new keys and test over there.

kelynch commented 6 months ago

I've added the production key in princeton_ansible here - https://github.com/pulibrary/princeton_ansible/pull/4636

hectorcorrea commented 6 months ago

@kayiwa reprovisioned the production boxes with the keys that @kelynch generated and Plausible shows data again:

Screenshot 2024-02-06 at 3 21 23 PM

kelynch commented 6 months ago

I've also added a local development key for Plausible to LastPass