woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 136 forks source link

ParseError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but wa... #9156

Open sentry-io[bot] opened 1 year ago

sentry-io[bot] commented 1 year ago

Sentry Issue: WOOCOMMERCE-ANDROID-607

IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 10 path $.data
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:358)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
...
(8 additional frame(s) were not displayed)

JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 10 path $.data
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:397)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1137)
    at com.google.gson.Gson.fromJson(Gson.java:1047)
    at com.google.gson.Gson.fromJson(Gson.java:1014)
...
(4 additional frame(s) were not displayed)

ParseError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 10 path $.data
    at org.wordpress.android.fluxc.network.rest.GsonRequest.parseNetworkResponse(GsonRequest.java:99)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:144)
    at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

FluxC: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 10 path $.data: API response parse error
atorresveiga commented 1 year ago

I wasn't able to reproduce the bug while SSPing into the stores.

Reading the error message, my first idea was to verify If something was changing the API response from array to object (some plugin, for example).

After checking the API response, everything seems to be working as expected.

I noted that all the crashes contain the call to the endpoint /wc-admin/onboarding/tasks/&_method=get, so I focused on this endpoint response but had no luck.

I also noted that most of the stores with this issue use the fr locale.

My second hypothesis was that the crash happened because of a problem reading the response (some non-english char causing the issue), but have no luck either

Here is an example of a call to the /wc-admin/onboarding/tasks/&_method=get while SSP into one of the stores with setting the locale to fr

Response ``` { "data": [ { "id": "setup", "title": "Soyez pr\u00eat \u00e0 vendre", "isHidden": false, "isVisible": true, "isComplete": false, "tasks": [ { "id": "store_details", "parentId": "setup", "title": "Ajouter les d\u00e9tails de la boutique", "canView": true, "content": "L\u2019adresse de votre boutique est n\u00e9cessaire pour d\u00e9finir le pays d\u2019origine pour l\u2019exp\u00e9dition, les devises et les options de paiement.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-settings&tab=general&tutorial=true", "isComplete": false, "time": "4\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "products", "parentId": "setup", "title": "Vous avez ajout\u00e9 des produits", "canView": true, "content": "Commencez par ajouter le premier produit \u00e0 votre boutique. Vous pouvez ajouter vos produits manuellement, via CSV ou les importer depuis un autre service.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "1\u00a0minute par produit", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "hasProducts": true }, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "payments", "parentId": "setup", "title": "Vous avez configur\u00e9 au moins un moyen de paiement", "canView": true, "content": "Choisissez les fournisseurs de paiement et activez les moyens de paiement lors de la validation de commande.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "tax", "parentId": "setup", "title": "Vous avez ajout\u00e9 des taxes de vente", "canView": true, "content": "D\u00e9finissez l\u2019emplacement de votre boutique et configurez les r\u00e9glages du taux de taxe.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "1\u00a0minute", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "avalaraActivated": false, "taxJarActivated": false, "woocommerceTaxCountries": [ "US", "CA", "AU", "GB", "AT", "BE", "BG", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO", "SE", "SI", "SK" ] }, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "marketing", "parentId": "setup", "title": "Augmenter les ventes", "canView": true, "content": "Ajoutez des outils marketing recommand\u00e9s pour atteindre de nouveaux clients et d\u00e9velopper votre entreprise", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": false, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "appearance", "parentId": "setup", "title": "Personnaliser votre boutique", "canView": true, "content": "Ajoutez votre logo, cr\u00e9ez une page d\u2019accueil et commencez \u00e0 concevoir votre boutique.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": false, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "hasHomepage": false, "hasProducts": true, "stylesheet": "Divi-Community", "themeMods": { "0": false, "custom_css_post_id": 24, "et_pb_css_synced": "yes", "nav_menu_locations": { "primary-menu": 3, "secondary-menu": 4, "footer-menu": 0 }, "et_updated_layouts_built_for_post_types": "yes" } }, "eventPrefix": "tasklist_", "recordViewEvent": false } ], "eventPrefix": "tasklist_", "displayProgressHeader": true, "keepCompletedTaskList": "no" }, { "id": "extended", "title": "\u00c9tapes suivantes", "isHidden": false, "isVisible": true, "isComplete": false, "tasks": [ { "id": "review-shipping", "parentId": "extended", "title": "V\u00e9rifier les options d\u2019exp\u00e9dition", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-settings&tab=shipping", "isComplete": true, "time": "", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "extended_tasklist_", "recordViewEvent": false }, { "id": "tour-in-app-marketplace", "parentId": "", "title": "D\u00e9couvrez o\u00f9 trouver de puissants modules compl\u00e9mentaires et int\u00e9grations pour votre boutique, gr\u00e2ce \u00e0 une visite de WooCommerce Marketplace.", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-addons&tutorial=true", "isComplete": false, "time": "", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "", "recordViewEvent": true }, { "id": "setup-facebook", "parentId": "extended", "title": "Advertise your products across Meta's platforms, including Facebook, Instagram, and WhatsApp", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-facebook", "isComplete": true, "time": "20 minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "extended_tasklist_", "recordViewEvent": false } ], "eventPrefix": "extended_tasklist_", "displayProgressHeader": false, "keepCompletedTaskList": "no" }, { "id": "setup_two_column", "title": "Soyez pr\u00eat \u00e0 vendre", "isHidden": false, "isVisible": true, "isComplete": false, "tasks": [ { "id": "products", "parentId": "setup_two_column", "title": "Ajouter mes produits", "canView": true, "content": "Commencez par ajouter le premier produit \u00e0 votre boutique. Vous pouvez ajouter vos produits manuellement, via CSV ou les importer depuis un autre service.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "1\u00a0minute par produit", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "hasProducts": true }, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "payments", "parentId": "setup_two_column", "title": "Configurer les paiements", "canView": true, "content": "Choisissez les fournisseurs de paiement et activez les moyens de paiement lors de la validation de commande.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "tax", "parentId": "setup_two_column", "title": "Configurer la taxe", "canView": true, "content": "D\u00e9finissez l\u2019emplacement de votre boutique et configurez les r\u00e9glages du taux de taxe.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": true, "time": "1\u00a0minute", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "avalaraActivated": false, "taxJarActivated": false, "woocommerceTaxCountries": [ "US", "CA", "AU", "GB", "AT", "BE", "BG", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO", "SE", "SI", "SK" ] }, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "marketing", "parentId": "setup_two_column", "title": "Configurer des outils marketing", "canView": true, "content": "Ajoutez des outils marketing recommand\u00e9s pour atteindre de nouveaux clients et d\u00e9velopper votre entreprise", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": false, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "tasklist_", "recordViewEvent": false }, { "id": "appearance", "parentId": "setup_two_column", "title": "Personnaliser ma boutique", "canView": true, "content": "Ajoutez votre logo, cr\u00e9ez une page d\u2019accueil et commencez \u00e0 concevoir votre boutique.", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": null, "isComplete": false, "time": "2\u00a0minutes", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": { "hasHomepage": false, "hasProducts": true, "stylesheet": "Divi-Community", "themeMods": { "0": false, "custom_css_post_id": 24, "et_pb_css_synced": "yes", "nav_menu_locations": { "primary-menu": 3, "secondary-menu": 4, "footer-menu": 0 }, "et_updated_layouts_built_for_post_types": "yes" } }, "eventPrefix": "tasklist_", "recordViewEvent": false } ], "eventPrefix": "tasklist_", "displayProgressHeader": false, "keepCompletedTaskList": "no" }, { "id": "extended_two_column", "title": "\u00c9tapes suivantes", "isHidden": false, "isVisible": true, "isComplete": false, "tasks": [ { "id": "review-shipping", "parentId": "extended_two_column", "title": "V\u00e9rifier les options d\u2019exp\u00e9dition", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-settings&tab=shipping", "isComplete": true, "time": "", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "extended_tasklist_", "recordViewEvent": false }, { "id": "tour-in-app-marketplace", "parentId": "", "title": "D\u00e9couvrez o\u00f9 trouver de puissants modules compl\u00e9mentaires et int\u00e9grations pour votre boutique, gr\u00e2ce \u00e0 une visite de WooCommerce Marketplace.", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "https://ateliernuage.fr/wp-admin/admin.php?page=wc-addons&tutorial=true", "isComplete": false, "time": "", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "", "recordViewEvent": true } ], "eventPrefix": "extended_tasklist_", "displayProgressHeader": false, "keepCompletedTaskList": "no" }, { "id": "secret_tasklist", "title": "", "isHidden": false, "isVisible": false, "isComplete": true, "tasks": [ { "id": "shipping-recommendation", "parentId": "secret_tasklist", "title": "Configurer l\u2019exp\u00e9dition", "canView": true, "content": "", "additionalInfo": "", "actionLabel": "C\u2019est parti", "actionUrl": "", "isComplete": true, "time": "", "level": 3, "isActioned": false, "isDismissed": false, "isDismissable": false, "isSnoozed": false, "isSnoozeable": false, "isVisited": false, "isDisabled": false, "snoozedUntil": null, "additionalData": null, "eventPrefix": "secret_tasklist_", "recordViewEvent": false } ], "eventPrefix": "secret_tasklist_", "displayProgressHeader": false, "keepCompletedTaskList": "no" } ] } ```