wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.93k stars 1.31k forks source link

"Couldn't update dashboard" error on sites hosted on WPCOM #19250

Open reginabally opened 9 months ago

reginabally commented 9 months ago

We have several reports from users with sites hosted on WordPress.com (Simple and Atomic) that they saw a "Couldn't update dashboard" error in the app after they signed in.

List of reports and the associated site ID:

These users are the site owners and administrators. One of the users reported that they could access WordPress.com dashboard on the mobile browser installed on the same device. Clearing app cache also didn't help.

Sample screenshot (site address masked to protect user's privacy):

CleanShot 2023-09-24 at 11 22 36@2x

Internal Slack discussions: p1695304572059739-slack-C03URUK5C

Reported since JPAndroid 23.0

zwarm commented 9 months ago

Notes: I ran across this yesterday, but I could not reproduce. Logs showed 404's on dashboard/cards-data, blogging-prompts, and rewind/capabilities calls; however I suspect that the underlying issue was caused by some type of connectivity issue. In reality, it we are getting 404's, then we couldn't get data and that would cause the message, but I wonder if we can handle this differently in the background.

reginabally commented 9 months ago

Another report in 7115769-zen. Blog ID 120874563 (WPCOM Simple).

I noticed this error in the logs which also appeared in other reported cases:

84 - [Oct-03 10:45 DB] Can't insert WP.com site http://qbit.blog, missing user account

Also, it's weird that the app showed an error when installing Jetpack because it's a Simple site:

85 - [Oct-03 10:45 STATS] 🔵 Tracked: install_jetpack_remote_failed, Properties: {"error_context":"JetpackRemoteInstall","error_description":"","error_type":"INVALID_INPUT"}
86 - [Oct-03 10:45 STATS] 🔵 Tracked: install_jetpack_remote_restart
87 - [Oct-03 10:45 API] Dispatching action: JetpackAction-INSTALL_JETPACK
88 - [Oct-03 10:45 SETTINGS] JetpackStore: JetpackAction.INSTALL_JETPACK
89 - [Oct-03 10:45 SETTINGS] JetpackStore: install
90 - [Oct-03 10:45 API] Volley error on https://public-api.wordpress.com/rest/v1/jetpack-install/http%3A%2F%2Fqbit.blog/?locale=en_US Status Code: 400 - exception: null
91 - [Oct-03 10:45 API] StackTrace: com.android.volley.ClientError at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:193) at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145) at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132) at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111) at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
enejb commented 8 months ago

This should not happen that a simple site tries to install Jetpack. Maybe something changed on the backend that triggers this? Under what conditions would this happen?

zwarm commented 8 months ago

I can't reproduce it, but I had captured the logs from the time i did experience it. Lot's of 403's. Authorization errors

"message": "Volley error on https://public-api.wordpress.com/rest/v1.1/sites/174754732/stats/visits/?unit\u003dweek\u0026quantity\u003d2\u0026date\u003d2023-10-09\u0026locale\u003den_US Status Code: 403\ncom.android.volley.AuthFailureError\n\tat com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:189)\n\tat com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)\n\tat com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)\n\tat com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)\n\tat com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)"

"message": "Today\u0027s Stats Error: unauthorized"

"message": "[95] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://public-api.wordpress.com/rest/v1.1/jetpack-blogs/174754732?locale\u003den_US"

message": "[95] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://public-api.wordpress.com/rest/v1.1/jetpack-blogs/174754732?locale\u003den_US"

"message": "[70] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://public-api.wordpress.com/wpcom/v2/sites/174754732/rewind/capabilities/?_locale\u003den_US"

 "message": "Volley error on https://public-api.wordpress.com/wpcom/v2/sites/174754732/rewind/capabilities/?_locale\u003den_US Status Code: 403\ncom.android.volley.AuthFailureError\n\tat com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:189)\n\tat com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)\n\tat com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)\n\tat com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)\n\tat com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)"

  "message": "Error fetching Jetpack Monitor module options: com.android.volley.AuthFailureError"

        "message": "[96] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://public-api.wordpress.com/rest/v1.1/sites/174754732/settings?locale\u003den_US"

              "message": "[89] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://public-api.wordpress.com/rest/v1.1/sites/174754732/jetpack/modules?locale\u003den_US"
SiobhyB commented 7 months ago

I came across a user with this issue in 7320459-zen. As described in the previous reports, the Can't insert WP.com site error is showing up in their logs:

10 - [Nov-17 14:53 DB] Can't insert WP.com site http://READACTED.net, missing user account
11 - [Nov-17 14:54 API] CardsStore: fetchCards
12 - [Nov-17 14:54 API] BloggingPromptsStore: fetchPrompts
13 - [Nov-17 14:54 API] Volley error on https://public-api.wordpress.com/wpcom/v2/sites/6369569/wordads/dsp/api/v1/search/campaigns/site/6369569?page=1&order=start_date&sort=desc&_locale=en_US Status Code: 400 - exception: null
14 - [Nov-17 14:54 API] StackTrace: com.android.volley.ClientError
    at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:193)
    at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

Their logs also support that there's authentication issues:

69 - [Nov-17 14:54 API] Dispatching action: AuthenticationAction-AUTHENTICATE_ERROR
70 - [Nov-17 14:54 API] Dispatching action: SiteAction-FETCHED_PLANS
71 - [Nov-17 14:54 DOMAIN_REGISTRATION] An error occurred while fetching plans :An active access token must be used to query information about the current user.

Full logs are in the ticket.

Troubleshooting steps they've already tried include uninstalling/reinstalling, clearing the app's cache via the Settings app, and logging out/in.

They have a simple site, and mentioned this started happening after they upgraded to WordPress.com Personal and added a custom domain. I attempted to reproduce this by adding a custom domain to a simple site, but haven't been able to get the same error described here. It may or may not be a red herring.

@zwarm, do you happen to have any ideas for how we can further debug this issue?

I added the [Pri] High label given the error's making the app completely inaccessible for some of our highest paying customers.

SiobhyB commented 7 months ago

Noting a couple of PRs where the Can't insert WP.com site error was mentioned/introduced, in case it's helpful for tracking: https://github.com/wordpress-mobile/WordPress-FluxC-Android/pull/1320, https://github.com/wordpress-mobile/WordPress-Android/pull/6012

zwarm commented 2 months ago

@SiobhyB - There was a major refactor to this part of the code in release 24.6. PR #19869 may have resolved this issue. Going to monitor the release. 🤞