Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats: The message "An error occurred" shows on the Insights tab #12945

Closed
designsimply opened this issue Nov 13, 2019 · 8 comments · Fixed by #22890
Closed

Stats: The message "An error occurred" shows on the Insights tab #12945

designsimply opened this issue Nov 13, 2019 · 8 comments · Fixed by #22890
Assignees
Milestone

Comments

@designsimply
Copy link
Contributor

designsimply commented Nov 13, 2019

Steps to reproduce:

  1. Log in to a WP.com account
  2. Select a regular WP.com account (free plan, free domain)
  3. Go to Stats
  4. Open the Insights tab
  5. Scroll down and notice any "An error occurred" messages
  6. Add more cards and again look for errors
  7. If no errors occur, try different sites until you see errors
@elibud
Copy link
Contributor

elibud commented Jun 9, 2020

@frosty can someone from your team look at both the iOS and Android issues? It might be that the site is taking a bit to sync so we may want to display a better message here.

@frosty
Copy link
Contributor

frosty commented Jun 17, 2020

Sure, we can take a look at this 👍

@staskus
Copy link
Contributor

staskus commented Jan 19, 2023

Update

I could reproduce the issue.

"An error occurred" on some cards appears because we receive data successfully but it's in the wrong format than the parser implemented in WordPressKit expects. The parser fails because some fields are missing.

For example, we get jsonResponse:

▿ 3 elements
  ▿ 0 : 2 elements
    - key : "country-info"
    - value : 0 elements
  ▿ 1 : 2 elements
    - key : "date"
    - value : 2023-01-18
  ▿ 2 : 2 elements
    - key : "days"
    - value : 0 elements { ... }

and we try creating StatsTopCountryTimeIntervalData out of it. However, because there's no views field, the parsing fails with ResponseError.decodingFailure.

Based on this, I don't see a direct connection with a Jetpack installation and these errors. I can reproduce the same issue after creating a fresh .com site.

Potential Solution

Based on this finding, we could consider:
a) be more relaxed in our decoding strategy and return an empty entity, or .empty status, instead of .decodingError
b) treat a .decodingError as an "Empty" state in the cards

It's also suggested to show "a welcome screen instead" if all the Stats are empty, however, showing the possible selection of cards and correctly displaying that they don't have data yet may be a better solution.

Priority

  • Frequency: The issue happens always and affects new sites
  • Severity: The issue does not break Stats behavior but misleads the users while the site Stats are empty

Priority: Low

@staskus staskus added [Pri] Low and removed Jetpack Install Anything related to the Jetpack Install process labels Jan 19, 2023
@staskus staskus changed the title Jetpack Install: after installing Jetpack via Stats the screen is blank with a "An error occurred" and "No data yet" notices Stats: After enabling Stats for a fresh site an "An error occurred" and "No data yet" notices appear Jan 19, 2023
@guarani
Copy link
Contributor

guarani commented Jun 21, 2023

I also see "An error occurred" on some parts of the screen on established sites (not fresh sites) when loading the Months or Years tabs.

@staskus
Copy link
Contributor

staskus commented Jun 21, 2023

I also see "An error occurred" on some parts of the screen on established sites (not fresh sites) when loading the Months or Years tabs.

@guarani, thanks for reporting. The error is quite generic, so there can theoretically be different types of failures. For empty sites, it happens because parsing fails due to an expected field missing. However, maybe the same thing is happening for established sites as well.

Update: The issue is reproducible with the en.blog.wordpress.com site

@dangermattic
Copy link
Collaborator

dangermattic commented Mar 16, 2024

Thanks for reporting! 👍

@guarani guarani changed the title Stats: After enabling Stats for a fresh site an "An error occurred" and "No data yet" notices appear Stats: The message "An error occurred" shows on the Insights tab Mar 16, 2024
@guarani guarani removed the [Pri] Low label Mar 16, 2024
@staskus
Copy link
Contributor

staskus commented Mar 18, 2024

More information from @guarani:

I tried a few setups and these errors weren't 100% reproducible but happened in maybe 1 out of 3 tries:

  • Existing account, existing Simple site, custom domain: Seeing "An error occurred" on Insights (Views & Visitors, Total Likes, Total Comments, Most Popular Time).
  • Existing account, existing Simple site, free domain: Same issues as above, also see the error on Insights (This Year, Posting Activity)
  • Existing account, existing Atomic site, free domain: Seeing "An error occurred" on Insights (Most Popular Time).

these established sites were testing sites and had very little traffic.

@staskus
Copy link
Contributor

staskus commented Mar 22, 2024

This is also one more big reason why "An error occurred" is shown. We load an error state by default from the cache if the value doesn't exist. Sometimes there simply be no value, for example, no latest post, so this logic can generate "An error occurred" for all the cards.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants