Shopify-api-node
Shopify-api-node copied to clipboard
GraphQL does not throw mutation errors
When doing a mutation shopify.graphql(mutationQuery) where the query is a mutation such as:
mutation {
customerCreate(
input: {
...
}
)
{
customer {
id
displayName
}
userErrors {
field
message
}
}
}
Errors are returned in the userErrors field. However the request promise resolves successfully. I was expecting the error to be thrown as it is done for normal queries.
The field used to check for errors is errors:
https://github.com/MONEI/Shopify-api-node/blob/c949c7d28c4d701283dcf806060dc0cc20e607e7/index.js#L236-L246
@lpinca I see that. According to all the Shopify docs I have seen. Mutation queries will have any error in the field userErrors
Some example doc references: https://shopify.dev/docs/admin-api/graphql/reference/customers/customeraddtaxexemptions https://shopify.dev/docs/admin-api/graphql/reference/customers/customercreate https://shopify.dev/docs/admin-api/graphql/reference/orders/ordereditsetquantity
Feel free to open a PR.