You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var orderRequest = new GraphRequest()
{
query =
@"mutation orderCancel($notifyCustomer:Boolean!, $orderId: ID!, $reason: OrderCancelReason!, $refund: Boolean!, $restock: Boolean!, $staffNote: String!) {
orderCancel(notifyCustomer: $notifyCustomer, orderId: $orderId, reason: $reason, refund: $refund, restock: $restock, staffNote: $staffNote) {
job {
done,
id
}
orderCancelUserErrors {
code,
field,
message
}
}
}",
variables = new
{
notifyCustomer = false,
orderId = "gid://shopify/Order/11239781433711",
reason = "CUSTOMER",
refund = true,
restock = true,
staffNote = "Test Order for free item",
}
};
//Make the API call
var orderResponse = new ShopifySharp.GraphQL.OrderCancelPayload();
try
{
orderResponse = _graphService.SendAsync<ShopifySharp.GraphQL.OrderCancelPayload>(orderRequest).Result;
}
catch (Exception ex)
{
}
The exception:
{
"ClassName": "System.AggregateException",
"Message": "One or more errors occurred.",
"Data": {
},
"InnerException": {
"ClassName": "System.InvalidOperationException",
"Message": "The polymorphic type 'ShopifySharp.GraphQL.INode' has already specified derived type 'ShopifySharp.GraphQL.ReturnLineItem'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)\r\n at System.Text.Json.Serialization.Metadata.PolymorphicTypeResolver..ctor(JsonSerializerOptions options, JsonPolymorphismOptions polymorphismOptions, Type baseType, Boolean converterCanHaveMetadata)\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type inputType)\r\n at System.Text.Json.JsonSerializer.GetTypeInfo[T](JsonSerializerOptions options)\r\n at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)\r\n at ShopifySharp.GraphQL.Serializer.Deserialize[T](String json)\r\n at ShopifySharp.GraphService.SendAsync[TResult](GraphRequest request, Nullable`1 graphqlQueryCost, CancellationToken cancellationToken)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233079,
"Source": "System.Text.Json",
"WatsonBuckets": null
},
"HelpURL": null,
"StackTraceString": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n at sf_ERP_Shopify_Sync_GraphQL.Orders.Push() in C:\\Repos\\sf_Shopify_ERP_Sync\\sf_ERP_Shopify_Sync_GraphQL\\Orders.cs:line 585",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233088,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null,
"InnerExceptions": [
{
"ClassName": "System.InvalidOperationException",
"Message": "The polymorphic type 'ShopifySharp.GraphQL.INode' has already specified derived type 'ShopifySharp.GraphQL.ReturnLineItem'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)\r\n at System.Text.Json.Serialization.Metadata.PolymorphicTypeResolver..ctor(JsonSerializerOptions options, JsonPolymorphismOptions polymorphismOptions, Type baseType, Boolean converterCanHaveMetadata)\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()\r\n at System.Text.Json.Serialization.Metadata.JsonTypeInfo.EnsureConfigured()\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType)\r\n at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type inputType)\r\n at System.Text.Json.JsonSerializer.GetTypeInfo[T](JsonSerializerOptions options)\r\n at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)\r\n at ShopifySharp.GraphQL.Serializer.Deserialize[T](String json)\r\n at ShopifySharp.GraphService.SendAsync[TResult](GraphRequest request, Nullable`1 graphqlQueryCost, CancellationToken cancellationToken)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233079,
"Source": "System.Text.Json",
"WatsonBuckets": null
}
]
}
It does actually cancel the order on the store, but just has an issue returning the response it looks like.
Let me know if you need any more info.
The text was updated successfully, but these errors were encountered:
I guess I will also add I'm running it as a .net 8 console application and tried it on system.text.json 8.0.5 as well as upgraded to 9.0.0 and ShopifySharp 6.18.0 as well as 6.19.0. The output above is from everything being upgraded in case it was fixed.
Thanks for the report! Could you try the latest pre-release version of ShopifySharp (version 6.19.0-b215) on Nuget and see if you get this same exception when using it?
When making the request:
The exception:
It does actually cancel the order on the store, but just has an issue returning the response it looks like.
Let me know if you need any more info.
The text was updated successfully, but these errors were encountered: