woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
301 stars 109 forks source link

Error synchronizing orders (Swift.DecodingError) on fee_lines #4818

Closed reginabally closed 3 years ago

reginabally commented 3 years ago

Describe the bug Reported in 4221767-zd-woothemes. The app wasn't able to load orders because of the following error:

2021/08/14 16:42:44:671  ⛔️ Error synchronizing orders: typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "fee_lines", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "meta_data", intValue: nil), _JSONKey(stringValue: "Index 2", intValue: 2), CodingKeys(stringValue: "display_value", intValue: nil)], debugDescription: "Expected to decode String but found an array instead.", underlyingError: nil))

Screenshots

image0

Mobile Environment Please include:

List of active plugins Full SSR can be found in the ticket.

``` VaultPress: - Automattic – 2.1.4 WPML Multilingual CMS: - OnTheGoSystems – 4.4.10 Redux: - Redux.io – 4.2.14 WPML SEO: - OnTheGoSystems – 2.0.1 PW Woocomerce Brands coupon Addons: - Proword – 1.3 ACF Content Analysis for Yoast SEO: - Thomas Kräftner ViktorFroberg marol87 pekz0r angrycreative Team Yoast – 3.0.1 Advanced Custom Fields Multilingual: - OnTheGoSystems – 1.8.2 Advanced Custom Fields: - Delicious Brains – 5.9.9 FiboSearch - AJAX Search for WooCommerce (Pro): - Damian Góra – 1.10.0 Akismet Anti-Spam: - Automattic – 4.1.10 iThemes Security: - iThemes – 8.0.2 Book shelf: - creativeinteractivemedia – 1.0.7 Booster Plus for WooCommerce: - Pluggabl LLC – 5.4.4 Classic Editor: - WordPress Contributors – 1.6.2 Code Snippets: - Code Snippets Pro – 2.14.1 Cookie Notice & Compliance for GDPR / CCPA: - Hu-manity.co – 2.1.1 Disable Comments: - WPDeveloper – 2.1.2 Enable jQuery Migrate Helper: - The WordPress Team – 1.3.0 Envato Market: - Envato – 2.0.6 Facebook for WooCommerce: - Facebook – 2.6.1 Force Regenerate Thumbnails: - Pedro Elsner – 2.0.6 Woody code snippets (PHP snippets | Insert PHP): - Creative Motion Will Bontrager Software LLC – 2.4.1 Jetpack: - Automattic – 10.0 WPBakery Page Builder: - Michael M - WPBakery.com – 6.7.0 Kirki Customizer Framework: - David Vongries – 3.1.9 Mailchimp for WooCommerce: - Mailchimp – 2.5.2 MakeCommerce: - Maksekeskus AS – 3.0.8 HubSpot for WooCommerce: - MakeWebBetter – 1.2.1 Max Mega Menu - Pro Addon: - megamenu.com – 2.2.3 Max Mega Menu: - megamenu.com – 2.9.4 Montonio for WooCommerce: - Montonio – 3.0.2 Nextend Social Login: - Nextendweb – 3.0.29 NextGEN Starter: - Imagely – 1.0.0 Facebook for WordPress: - Facebook – 3.0.5 Porto Theme - Functionality: - P-Themes – 1.7.1 Product Filter for WooCommerce: - 7VX LLC USA CA – 7.0.7 Real Media Library: - devowl.io – 4.14.2 Real3D Flipbook: - creativeinteractivemedia – 3.22 Slider Revolution Bubblemorph AddOn: - ThemePunch – 3.0.4 Slider Revolution: - ThemePunch – 6.5.6 WooCommerce Estimated Shipping Date Per Product: - Magerips – 3.8 WooCommerce Split Orders: - Vibe Agency – 1.4.0 Sucuri Security - Auditing, Malware Scanner and Hardening: - Sucuri Inc. – 1.8.28 SumUp Payment Gateway For WooCommerce: - SumUp – 1.0.0 Tawk.to Live Chat: - Tawkto – 0.5.5 UpdraftPlus - Backup/Restore: - UpdraftPlus.Com DavidAnderson – 1.16.59 E-liides modules: - Priit Elbe – 1.0 Woocomerce Brands Pro: - Proword – 4.3.9 Woocommerce ESTO: - Mikk Mihkel Nurges Rebing OÜ – 2.14.10 WooCommerce Blocks: - Automattic – 5.7.0 Variation Swatches for WooCommerce - Pro: - Emran Ahmed – 1.1.17 Variation Swatches for WooCommerce: - Emran Ahmed – 1.1.17 WooCommerce Admin: - WooCommerce – 2.5.1 WooCommerce Advanced Bulk Edit: - George Iron – 5.0.1 WooCommerce Bulk Editor: - realmag777 – 2.0.5.1 Print Invoice & Delivery Notes for WooCommerce: - Tyche Softwares – 4.6.4 WooCommerce Stripe Gateway: - WooCommerce – 5.3.0 Indivy Pay Later Platform by Inbank: - Inbank – 1.2.0 Booster for WooCommerce: - Pluggabl LLC – 5.4.4 WooCommerce Multilingual: - OnTheGoSystems – 4.11.6 WooCommerce Order Status Manager: - SkyVerge – 1.13.2 WooCommerce Shipping & Tax: - WooCommerce – 1.25.18 WooCommerce Smart Coupons: - StoreApps – 4.25.1 WooCommerce TM Extra Checkout Options: - themeComplete – 1.7.6 WooCommerce TM Extra Product Options: - themeComplete – 5.1 WooCommerce Twilio SMS Notifications: - SkyVerge – 1.16.1 WooCommerce: - Automattic – 5.5.2 WooThumbs for WooCommerce by Iconic: - Iconic – 4.8.3 Wordfence Security: - Wordfence – 7.5.5 Yoast SEO Premium: - Team Yoast – 14.9 WP Disable: - optimisation.io - jody nesbitt – 1.6.1 WP-failihaldur: - mndpsingh287 – 7.1.2 WP Rocket: - WP Media – 3.9.0.5 WP Rollback: - Impress.org – 1.7.1 WP Sitemap Page: - Tony Archambeau – 1.6.4 Smush Pro: - WPMU DEV – 3.8.8 WPForms Custom Captcha: - WPForms – 1.3.1 WPForms Mailchimp: - WPForms – 2.1.0 WPForms: - WPForms – 1.6.8.1 WPML CMS Nav: - OnTheGoSystems – 1.5.5 WPML Media: - OnTheGoSystems – 2.6.4 WPML Sticky Links: - OnTheGoSystems – 1.5.4 WPML String Translation: - OnTheGoSystems – 3.1.8 WPML Translation Management: - OnTheGoSystems – 2.10.6 WPMU DEV Dashboard: - WPMU DEV – 4.11.2 Yoast SEO: WooCommerce: - Team Yoast – 13.8 WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels (Pro): - WebToffee – 4.2.0 XforWooCommerce: - XforWooCommerce – 1.6.4 YITH Point of Sale for WooCommerce: - YITH – 1.0.14 YITH WooCommerce Badge Management Premium: - YITH – 1.4.15 YITH WooCommerce Compare Premium: - YITH – 2.3.23 YITH WooCommerce Delivery Date Premium: - YITH – 2.1.33 YITH WooCommerce PDF Invoice and Shipping List Premium: - YITH – 2.0.31 YITH WooCommerce Wishlist Premium: - YITH – 3.0.20 Zotabox: - Zotabox – 1.9.0 NextGEN Gallery: - Imagely – 3.13```
shiki commented 3 years ago

I asked if someone can take a look at this. p1629252901306900-slack-C6H8C3G23

itsmeichigo commented 3 years ago

It seems like the problematic field is display_value (caused by some certain plugins), and we're not supporting non-string values for this field.

@ThomazFB suggested that we fall back to use value when mapping display_value fails as they did on Android (p1629254204307800/1629252901.306900-slack-C6H8C3G23). I think it makes sense for iOS to do the same, but I'm leaving the decision to folks who have better context on the feature.

Ecarrion commented 3 years ago

Hi @reginabally!

The code @itsmeichigo mentions actually fixes that problem and lets orders load even when there is an unexpected format for any metadata field.

However, that fix was merged recently and is scheduled to be released on 7.4 which should be available on September 06, 2021.

The conflicting bit seems to be related to "Eco fields" but I'm not sure what is the specific plugin.

{
  "display_value": [
    "ei"
  ],
  "id": 88049,
  "key": "_wc_eco_fields_value",
  "value": [
    "ei"
  ],
  "display_key": "_wc_eco_fields_value"
}

Running that site in 7.4 works correctly.

@shiki should we close this?

shiki commented 3 years ago

@reginabally Would you mind asking them to try to update the app? If that fixes the problem, we can close this issue.

shiki commented 3 years ago

And Ernesto just reminded me that 7.4 won't be released until September. Clearly, I did not read his response above. 🤪

Yeah, let's probably close this then and we can just reopen if they come back and say it's not fixed.

shiki commented 3 years ago

Aaron suggested that they can also join the Beta Program. 7.4 will be available on the Beta on Tuesday.

reginabally commented 3 years ago

Thank you for the update @Ecarrion @shiki! I will ask the user to join the Beta Program.