这是indexloc提供的服务,不要输入任何密码
Skip to content

Order Cancel response unable to serialize OrderCancelUserErrorCode #1202

@MusicMonkey5555

Description

@MusicMonkey5555

This should be an easy quick fix and I'm hoping it wasn't already fixed (I updated from 6.22.2 to 6.24.1 and didn't noticed a change.
I'm getting the following exception when canceling some orders:
One or more errors occurred. (The json serializer threw a System.Text.Json.JsonException exception when deserializing the 'data' property into a sf_ERP_Shopify_Sync_GraphQL.Models.IO.OrderCancelResult. Check the inner exception for more details.) - The json serializer threw a System.Text.Json.JsonException exception when deserializing the 'data' property into a sf_ERP_Shopify_Sync_GraphQL.Models.IO.OrderCancelResult. Check the inner exception for more details. - The JSON value could not be converted to System.Nullable'1[ShopifySharp.GraphQL.OrderCancelUserErrorCode]. Path: $.orderCancel.orderCancelUserErrors[0].code | LineNumber: 0 | BytePositionInLine: 76.

So it seems like Shopify is just returning an enum value not in code:
///<summary> ///Possible error codes that can be returned by 'OrderCancelUserError'. ///</summary> public enum OrderCancelUserErrorCode { ///<summary> ///An order refund was requested but the user does not have the refund_orders permission. ///</summary> NO_REFUND_PERMISSION, ///<summary> ///The record with the ID used as the input value couldn't be found. ///</summary> NOT_FOUND, ///<summary> ///The input value is invalid. ///</summary> INVALID, }
Especially after looking at the list of them:
https://shopify.dev/docs/api/admin-graphql/2024-10/enums/OrderCancelUserErrorCode.
I wasn't able to log the full response text before deserializing, so I'm not sure what error code was returned or if even though the API is at version 2024-10 they passing the latest values:
https://shopify.dev/docs/api/admin-graphql/latest/enums/OrderCancelUserErrorCode
Or something.

Let me know if you need more info. We haven't had a lot of time to keep up to date with changes as we are on other big projects currently and this error is not a big deal since it seems to have actually canceled the order just fine after looking at it in the Shopify Admin.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions